hasChildren re-evaluation

2 posts, 0 answers
  1. Greg
    Greg avatar
    1 posts
    Member since:
    Mar 2018

    Posted 26 Nov 2018 Link to this post

    i'm initializing a treeview control which has the hasChildren property set on the model as a function and a remote based datasource.

    is there any way to force a re-evaluation of the hasChildren function on a given node without re-reading from the remote server?




  2. Joana
    Joana avatar
    210 posts

    Posted 28 Nov 2018 Link to this post

    Hi Greg,

    You could get the dataItem and directly access its hasChildren property. So, you could find the TreeView dataItem via the getByUid method of the dataSource:


    The code would look something as follows:

    var treeView = $("#treeview").data("kendoTreeView");
    var dataItem = treeView.dataSource.getByUid("3f88bc92-72c4-4f6e-8635-0f0e2bdb0606")

    However, for removing and adding nodes to use the append method of the treeview and the remove method of the TreeView. Even if you could set the hasChildren field to new value, the already rendered node will not be updated, and thus, unexpected behavior might occur. 



    If you need further assistance, you might share more details on the use case you are implementing and a sample project of the achieved.

    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top