myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mmca <m.mcallis...@asidua.com>
Subject Quick solution to tree2's preserveToggle
Date Wed, 05 Apr 2006 11:08:30 GMT

I use the tomahawk tree2 to display contents in my database.  The tree
structure is created in my code and leaf and node elements will vary greatly
depending what the user is viewing.

I overcame the problem of the preserve toggle attempting to output a node
when it was actually a leaf, by setting preserveToggle="false" though now I
want some way to retain the toggle state.  Is there any way to retain toggle
state depending on root id, or a way to attempt to redraw the tree, and if a
leaf is found where a node is expected, to render the leaf and ignore the
problem?

Code to create tree

// root node
TreeNode treeData = new TreeNodeBase("a", value.getTitle(), value.getId(),
false);
// it's children
for(iterator iter=values.iterator;iter.hasNext() ) {
  // go through list making tree node's again
  TreeNode node = new TreeNode(...)
  // go through it's children if it has any
  for(iterator iter2=values2.iterator;iter2.hasNext() ) {
    TreeNode node2 = new TreeNode(...)
    node.getChildren().add(node2)
  }
  treeData.getChildren().add(node)
}


Any sort of solution to smartly preserve the toggle state and control when
to delete this in the controller, or a solution as mentioned above would be
very much appreciated.
Cheers
Michael.
--
View this message in context: http://www.nabble.com/Quick-solution-to-tree2%27s-preserveToggle-t1398764.html#a3762228
Sent from the MyFaces - Users forum at Nabble.com.


Mime
View raw message