43
Views
2
Comments
Solved
[GTree] How do expand the checked levels on the Gtree on initialize
gtree
Reactive icon
Forge asset by Pedro Neto

I am exploring the gtree component, and i have a long list on the Gtree with 3 levels.

When i am opening the Gtree (that is inside of a Popup), i want to see all the checked levels, expanded (e.g. if i have one level 3 selected, i have to see the level 2 and level 1 parent expanded on initialize), but i haven't the knowledge to create a JS that make this. Some help?

2021-09-06 15-09-53
Dorine Boudry
 
MVP
Solution

Hi  @Toretto ,

I don't think you need any JS for this.  The nodelist that you feed to the component, has the property IsOpen available for each node.

So all you need to do, is to have the appropriate logic in place when building your nodelist, to make sure that the ones you want are opened upon rendering.

So at worst something like going through the nodelist a few times to recursively open up the parent node of each child that is open, but maybe dependent on your model you can make something a little smarter.  

If this is not enough info for you, share an oml with an example of what you are doing, with your 3 levels, we can help you with that.

Dorine

UserImage.jpg
Pedro Ricarte

Yes, you right.

I had to build some logic to assign the true or false variable to assign on my structure to populate the IsOpen property.

Thanks

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.