myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From omaji7 <oma...@gmail.com>
Subject Re: [Trinidad] request backed TreeTable
Date Fri, 18 Dec 2009 10:13:56 GMT

Hi,

My project is build in JSF, Hibernate and Faclets. i m using trinidad
treetable tag to build a tree with multiselection nodes. Now i m facing a
problem to initially selection of the nodes when page is loaded at the first
time. i have tried alot to accomplish this task, but still unable to retain
it. There is an attribute of "selectedRowKeys" in TreeTable which takes the
object of "RowKeySet", but when i am building the tree in my bean, i don't
know the RowKeys generated, so how do i get my desired RowKeys to be
selected in the tree?

i am trying to provide the code below

myTree.xhtml

<tr:treeTable id="testTreeTable"
                                  value="#{RoleManageBean.tree}"
                                  var="node"
                                  rowSelection="multiple"
                                  initiallyExpanded="true"
                                  rowBandingInterval="1"
                                  horizontalGridVisible="true"
                                  verticalGridVisible="true"
                                 
selectedRowKeys="#{RoleManageBean.selectedRowKeys}">
                        <f:facet name="actions">
                            <tr:commandButton id="treeTableSelectButton"
text="Submit Sel." action="#{RoleManageBean.treeTableSelect}" />
                        </f:facet>
                        <f:facet name="nodeStamp">
                            <tr:column headerText="Name">
                                <tr:outputText value="#{node.name}"/>
                            </tr:column>
                        </f:facet>
                        <f:facet name="pathStamp">
                            <tr:outputText value="#{node.name}"/>
                        </f:facet>
                    </tr:treeTable>


MyBean.java

public class RoleManageBean implements Serializable {

    private TreeModel tree;
    private RowKeySet selectedRowKeys = null;

public TreeModel getTree() throws Exception {
        Application[] applications = dbops.getAllApplications();
        List<Node1> empty1 = Collections.emptyList();
        List<Node1> root1 = new ArrayList<Node1>();
        List<Node1> apps = new ArrayList<Node1>();
        for (Application application : applications) {
            Set<ApplicationPage> appPages =
application.getApplicationPage();
            List<Node1> pages = new ArrayList<Node1>();
            for (ApplicationPage applicationPage : appPages) {
                pages.add(new Node1(applicationPage.getPageName(),
String.valueOf(applicationPage.getPageID()), empty1));
            }
            apps.add(new Node1(application.getApplicationName(),
String.valueOf(application.getHomePage().getPageID()), pages));

        }
        root1.add(new Node1("Applications", "0", apps));
        tree = new ChildPropertyTreeModel(root1, "children");
       
        return tree;
    }

public RowKeySet getSelectedRowKeys() {
        selectedRowKeys = new RowKeySetImpl();
        selectedRowKeys.add(String.valueOf("1,0"));
        System.out.println("called");
        return selectedRowKeys;
    }

    public void setSelectedRowKeys(RowKeySet selectedRowKeys) {
        this.selectedRowKeys = selectedRowKeys;
    }


Any guideline will be appriciated. Thanks in Advance

Majid. 

Andrew Richards-2 wrote:
> 
> Hi, I have a Trinidad TreeTable displaying my hierarchy of selectable data
> which works fine.
> 
> The problem I having is that when I user selects a row in the table and
> then navigates away from the page and the returns to the page, the
> treeTable selection is persisted and the row is expanded and selected? My
> backing bean is request scoped, which confuses me?
> 
> Does anyone know how I can force the TreeTable to return to its original
> state on every new request?
> 
> Many thanks,
> 
> Andy
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/-Trinidad--request-backed-TreeTable-tp12996112p26841534.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Mime
View raw message