Tree component loading time

I am using tree component to show hierarchical data. I have 25000 items in table and it is taking too much time. (data will reach up to 1,00,000 in future)

Is there a way i can reduce this by replacing tree with lookup and tree. The first level is selected by look up then based on lookup value the tree is constructed. This may reduce the loading time.

Can you guide me how to write query for tree based on lookup selection. ( recursive query support is present in cuba, for collection?) or any other ways to do this.

Regards

Umesh

Hi,

Sure you can do that.

I have prepared an example for you: GitHub - mariodavid/cuba-example-treefilter

With that you have a filter component for the top level elements. The Entity Pet has a parent attribute, which holds the direct parent pet. Then there is an additional topLevelParent attribute, which always holds the reference to the first entry in the tree-chain. The reason for that is, that relational databases are not very good in doing graph traversal.

Then the tree table is filtered based on that attribute topLevelParent.

Live Example

overview

Cheers
Mario

Thanks Mario, This was really helpful.

As table already have data, I used your approach but based on available columns and it worked.

Thanks.

Umesh Sharma