Unchecking TreeView items with loadOnDemand = true

3 posts, 0 answers
  1. Ocean Software
    Ocean Software avatar
    3 posts
    Member since:
    Aug 2013

    Posted 12 Sep 2014 Link to this post


    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. Ocean Software
    Ocean Software avatar
    3 posts
    Member since:
    Aug 2013

    Posted 12 Sep 2014 Link to this post

    Sorry for typo in the last section. Should read: ...if... loadOnDemand = false, it will take terrible time to apply all checks...
  3. Alex Gyoshev
    Alex Gyoshev avatar
    2497 posts

    Posted 16 Sep 2014 Link to this post


    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.

    Alex Gyoshev
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top