• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

<rich:tree> Problem with queueNodeExpand() to expand a Path to a leaf

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I am using a rich:tree to display chapters and leafs. A user can click on a chapter to add a new leaf and is forwarded to another page with an input mask. After saving the leaf he is returned to the tree. My goal is to expand a path in the tree from the root to the newly added node. So I stored the id of the newly added node in the session in order to access it upon returning to the TreeView.
As of yet I did not succeed to get the nodes to expand to the newly added node.

I tried several variants. First I used this adviseNodeOpened= binding in the rich tree:



This does expand all nodes up to the depth of 2 but it does not expand a path to the newly added node (expandedNodeId). Debuging confirmed that the method does return true for the node with the expandedNodeId. I suspect the Problem is that the Parents of the Node will usually not be expanded. I could check for every Node if there is a node with the expandedNodeId deeper in the tree but that seems inefficient.

So I tried another aproach. I read that the rich:tree has some handy methods to expand like richTree.queueExpandAll(). To test the concept I placed a button on my page to expand the whole Tree. If I had been successfull I would have used the richTree.queueNodeExpand() method to expand a path to my desired Node.

I made a binding like this


Then I placed a button in the same form that rich:tree is in

and finally the code of the viewFragebogenBean#expandAll method



Unfortunatly the tree will not expand upon pressing the button. I could not figure out why. The binding of rich:tree seems to be working and the expandAll() method runs without error. However there is no reaction on the tree in the browser. If anyone has another idea to expand a path to the desired node or spots an error in my code I would greatly appreciate it.

 
If you were a tree, what sort of tree would you be? This tiny ad is a poop beast.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic