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

Unchecking TreeView items with loadOnDemand = true

2 Answers 55 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Ocean Software
Top achievements
Rank 1
Ocean Software asked on 12 Sep 2014, 08:10 AM
Hi,

It seems to me TreeView element is not working correctly for such scenario.

1. Read action controller sets checked attribute to true if corresponding item can be found in specific table or has an ancestor item found in that table.
2. There is a TreeView element with checkboxes enabled, checkChildren and loadOnDemand are turned on.

Workflow: user unchecks some item, which has children and was checked before, but not expanded. Then user expands the node, and all checks return back, because they are assigned to subitems based on the status in table without considering the fact that some change has happened on front-end already.

Similarly, if neither an item, nor any of its sub-items was checked, then item gets checked, then expanded - all checks will disappear.

I do understand that this is a complex issue, but please advise what options do I have now, except of advising users not to expand after checking or unchecking, or to expand before checking or unchecking?

Please note that if I do loadOnDemand = true, it will take terrible time to apply all checks accordingly (the number of treeview items is hundreds already and will grow).

Thank you.

2 Answers, 1 is accepted

Sort by
0
Ocean Software
Top achievements
Rank 1
answered on 12 Sep 2014, 08:13 AM
Sorry for typo in the last section. Should read: ...if... loadOnDemand = false, it will take terrible time to apply all checks...
0
Alex Gyoshev
Telerik team
answered on 16 Sep 2014, 08:21 AM
Hello,

It all depends on the state that is returned from the server. If the server returns conflicting data, the TreeView resolves the conflict based on the actions of the user (i.e. if the user has clicked, then it is likely that the user needs that selection. You can send requests to the server on each checkbox check, and that will make the server state closer to what the user expects -- i.e. unless another user modifies the state at the same time, it will be what the user expects. To handle conflicts manually, you can declare a custom transport (set read as a function), fetch levels via an $.ajax call, and show a message to the user if there is conflicting state between the items coming from the server and the ones in the TreeView.

Regards,
Alex Gyoshev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
TreeView
Asked by
Ocean Software
Top achievements
Rank 1
Answers by
Ocean Software
Top achievements
Rank 1
Alex Gyoshev
Telerik team
Share this question
or