You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Neil Hoskins (JIRA)" <de...@myfaces.apache.org> on 2006/03/07 01:54:31 UTC

[jira] Commented: (TOMAHAWK-126) Allow tree2 to work within dataList and dataTable

    [ http://issues.apache.org/jira/browse/TOMAHAWK-126?page=comments#action_12369118 ] 

Neil Hoskins commented on TOMAHAWK-126:
---------------------------------------

I've looked into this issue extensively as it is blocking a project I am working on. I'm fairly new to JSF but after a bit of research it appears that there are a couple of problems that are happening here. The first is that the Id's for the tree nodes are not unique and the JavaScript is always toggling the first tree in the list which as already been covered. The second is a little more serious and creates an inconsistent state within the tree that then causes the page to crash with the following error:

java.lang.IllegalStateException: Encountered a node [0:1] + with an illogical state.  Node is expanded but it is also considered a leaf (a leaf cannot
 be considered expanded.
        at org.apache.myfaces.custom.tree2.HtmlTreeRenderer.encodeNavigation(HtmlTreeRenderer.java:463)
        at org.apache.myfaces.custom.tree2.HtmlTreeRenderer.encodeCurrentNode(HtmlTreeRenderer.java:346)
        at org.apache.myfaces.custom.tree2.HtmlTreeRenderer.encodeTree(HtmlTreeRenderer.java:248)
        at org.apache.myfaces.custom.tree2.HtmlTreeRenderer.encodeChildren(HtmlTreeRenderer.java:211)
        at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:319)

After debugging the Tree component it looks like this is caused by the TreeState object being saved and restored for one instance of the tree only and then the value being set each iteration of the loop that is different from the state that was saved. Because the value (TreeNodes) is potentially different in a different iteration of the loop that the state of the tree, then what is happening is that you end up with nodes that have been set as expanded in the state that are actually leaf nodes in the value. 
I haven't found a decent workaround for this yet but am working on it. Don't expect miracles though, I get paid to implement JSF in a product but because this is a blocker for our product, then we may decide to skip the tree because it is taking to much time.



> Allow tree2 to work within dataList and dataTable
> -------------------------------------------------
>
>          Key: TOMAHAWK-126
>          URL: http://issues.apache.org/jira/browse/TOMAHAWK-126
>      Project: MyFaces Tomahawk
>         Type: Bug
>   Components: Tree2
>     Reporter: Daniel Ray

>
> Placing a tree2 component within a dataTable or dataList renders correctly but the onClick method generates code similar to the following for each row.
> onclick="treeNavClick('org.apache.myfaces.tree.TOGGLE_SPAN:productTree:0'
> This has the effect of selecting a node in another tree in a separate row to always expand/collapse the tree component within the first row. (Though the +/- icon will change for the selected row).
> Perhaps passing the id of the dataList or dataTable (much like dataScroller) to the tree2 component will help to generate unique ids for each nav image rendered.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira