question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Provide a way to lazy load tree node sub-items.

See original GitHub issue

Hi thanks for premium quality free library. I am in demand of new feature for tree structure.There is some scenario in which i need to load children of a node lazily on demand, but i couldn’t find formal way of doing that and i made it working using a trick. my trick right now is using dataTreeRowExpanded event and make an ajax request for sub-items and populating row’s model children property with new data and calling updateData on table instance but definitely this is not best practice.At least providing another event handler like dataTreeBeforeRowExpand will avoid extra call to updateData. thanks for you’r concern

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
olifolkerdcommented, Feb 17, 2019

Im afraid there is no way to achieve this with a good user experience.

The table is simply not setup to load data asynchronously into child rows, and even if it were it would be a terrible user experience for users to click an element and nothing happen for a while untill the data loaded.

For that reason i have no intention of adding this as a feature to Tabulator.

That being said, if you wanted to implement something yourself it should be achievable.

I would recommend that you populate your rows with a dummy “loading” row that displays an ajax spinner when it is opened, that way the user is then aware that they are waiting for data.

you could then use the dataTreeRowExpanded callback to request the data, and then call the update function on the row component to pass the new children into the row.

I Hope that helps,

Cheers

Oli 😃

0reactions
drivera-armediacommented, Mar 6, 2020

I seem to have spoken too soon… the row.update() invocation causes the expansion to fail. If I remove that, the row is expanded correctly with the placeholder data from the base template.

I also tried row.getTable().updateRow(row.getIndex(), newData)

I also tried adding a row.reformat() invocation to the update promise…no dice…

The reason this is necessary is because we know that the initial “summary” will return a LOT of rows, but it’s very very quick, so we can display the full table. However, if we try to pull the details for each row, then things get VERY slow because the detail fetches are expensive when done in bulk.

Thus, it’s cheaper to just pull the details on demand as the user needs them (i.e. they expand each row). We don’t do pagination because we chose to keep the server-side API simple.

So…thoughts?

Read more comments on GitHub >

github_iconTop Results From Across the Web

BreadcrumbControl with lazy loading TreeView and back ...
You will need to manually implement the desired behavior. To do this, you can generate available items in your BreadcrumbControl on demand. To ......
Read more >
Some issues with treeview lazy loading (on-demand) - Telerik
1. When the treeview have lots of subitems, it generates too many "databind" when we expand it, if loadOnDemand = false. But, that...
Read more >
Jstree Lazy loading with limit offset - jquery - Stack Overflow
I saw that post, it is rendering fast but in my case, my request takes nearly 3minutes to bring 50k nodes, so I...
Read more >
Loading sub items of TreeView in background
If PRELOADING_DEPTH might ever be 0 or loading time may be really long ... (just invoke the lazy load method when you populate...
Read more >
Lazy Loading | Data | Wijmo Docs - GrapeCity
Clear the node's lazy-loaded data when the node is collapsed; Re-bind the tree to remove the old nodes. Feedback. Submit and view feedback...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found