This is a migrated thread and some comments may be shown as answers.

Load on demand with refresh of node without affecting children already loaded

1 Answer 162 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 26 Apr 2017, 04:01 AM

The treeview is currently configured to load on demand.

Scenario is this I need to be able to refresh a node (ask database) due to one of the following actions from a user:

 

1. Adding of a new node under currently selected item.
2. Deleting of a node that is the currently selected item.
3. Updating the name of the currently selected item.

 

I have this working however if the selected node is expanded and all nodes below are expanded also - the state of the branch up to the selected node is retained but the nodes past the selected node are now collapsed after a reload of the selected node. (In the case of the delete - I refresh the parent node).

 

Is there a way to maintain the state of the branches so that a refresh does not collapse the branch below the refresh point?

 

If my description is insufficient I can explain with a more specific scenario and include screen shots.

1 Answer, 1 is accepted

Sort by
0
Nencho
Telerik team
answered on 27 Apr 2017, 11:07 AM
Hello David,

Indeed the experienced is expected, due to the binding scenario that you have ant the updates of the node. You can, however, try to implement the approach demonstrated in the following documentation article. 

http://docs.telerik.com/kendo-ui/controls/navigation/treeview/how-to/integration/persist-expanded-state


The article demonstrates how to store the expanded nodes in the Cookies and then restore them. Since you use load on demand at your end, you would need to use the load method on the item that needs to be expanded. Consider the below exemplary implementation:

http://dojo.telerik.com/@nenchef/iGoHi/9


Regards,
Nencho
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
TreeView
Asked by
David
Top achievements
Rank 1
Answers by
Nencho
Telerik team
Share this question
or