4 Replies Latest reply on Oct 16, 2007 10:40 AM by Chris Hane

    Trinidad/TreeTable and how to determine selected rows

    Chris Hane Novice

      I am using the Trinidad TreeTable component. We present the component and the user can select a number of rows. When an commandButton is selected, we are trying to figure out a good way to get the selected rows in our method call.

      Here's what we have:

      Facelets fragment

       <tr:form id="frm">
       <f:facet name="separator"><tr:spacer width="8px"/></f:facet>
       <tr:panelHeader text="Courses">
       <tr:commandButton text="Save" action="#{lister.save}" id="btn_save"/>
       <tr:treeTable var="foo"
       <f:facet name="nodeStamp">
       <f:facet name="header">
       <tr:outputText value="Name"/>
       <tr:outputFormatted value="#{foo.name} : #{foo.type} : #{foo.id}"/>

      And the Seam component is:
      public class CourseLister implements ICourseLister {
       TransferObject root;
       private TreeModel tree;
       public String save(){
       System.out.println("SAVE DONE>>>>");
       return null;
       public String showCourses(){
       //<snip creation of a transfer object that contains the tree/>
       //convert the root object into a Trinidad TreeModel
       tree = new ChildPropertyTreeModel(root, "children");
       return "viewList";
       public void selectionBindingMethod(SelectionEvent event){
       UIXCollection table = (UIXCollection)event.getSource();
       for(Iterator<Object> i = ((UIXTree)table).getSelectedRowKeys().iterator(); i.hasNext(); ){
       Object n = i.next();
       AppUtils.LOG.fatal("KEYSET ITERATION["+n+"] class["+n.getClass().getName()+"]");
       TransferObject to = (TransferObject)table.getRowData();
       public TreeModel getTree(){
       AppUtils.LOG.fatal("GET TREE............");
       return tree;

      Since we can not bind the tree component to the class (this is a conversation scoped bean), we are using the selectionListener.

      However, the listener is not getting called until *after* the commandButton lister.save action is called (that is the button that is pressed). Therefore, I don't have the information in the save method about what rows are selected.

      Thoughts on other approaches to try?

      Seam 1.2.p1
      jboss 4.0.4