[prev in list] [next in list] [prev in thread] [next in thread] 

List:       myfaces-user
Subject:    [Trinidad] tr:tree seems to "loose" bound Disclosed RowKeySet
From:       James A R Brown <james () enrogen ! com>
Date:       2011-10-28 7:28:03
Message-ID: 1319786883.2251.21.camel () enrogen ! org
[Download RAW message or body]

Hi,

I am trying to implement a bound rowKey set, which if you click the [+]
works fine, and if you click the rowItem (commandLink in this case) also
expands etc fine.

However, if you utilise one method and then the other, it breaks and
does not expand. The [+] continues to work.

The purpose is so I can set the inline style of the last clicked / last
expanded tree node of commandLink later on.

This is my lastest of many variants trying a af:setActionListener 

<tr:tree id="tree1" 
 rowDisclosureListener="#{coreTree.rowDisclosureListener}"
 binding="#{coreTree.tree}" var="model"
 inlineStyle="width:200px" value="#{catalogue.treeModel}">
  
 <f:facet name="nodeStamp">
   <tr:commandLink
    inlineStyle="#{coreTree.style}" 
    text="#{model.folderName}">
    <tr:setActionListener from="#{coreTree.tree.rowKey}" 
     to="#{coreTree.selectedRowKey}"/>
   </tr:commandLink>
  </f:facet>

</tr:tree>


And my coreTree class

public void setSelectedRowKey(Object rowKey) {
 //Store the rowKey
 selectedRowKey = rowKey;

 //Toggle it
 tree.getDisclosedRowKeys.invert(); <<<code that subsequently fails to
execute after a [+] expansion has occured
}

    public void rowDisclosureListener(RowDisclosureEvent rde) {
        Object rowKey = tree.getRowKey();

        if (rde.getAddedSet().isContained()) {
            //Set it as the selected row key
            //Do not call setSelectedRowKey as if we are here
            // invert(rowKey) has already occured
            selectedRowKey = rowKey;
        }

        if (rde.getRemovedSet().isContained()) {
            selectedRowKey = null;
        }
        
    }

Its almost as if the coreTree.tree is switching its DisclosedRowKey set
to another rks after [+] is clicked.

James

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic