TreeList Collapse event handler prevents node collapse

4 posts, 0 answers
  1. Matthew
    Matthew avatar
    4 posts
    Member since:
    Sep 2017

    Posted 19 Sep Link to this post

    Inside of the TreeList's collapse event handler I put the line e.model.loaded(false); to force the TreeList widget to reload the nodes every time it expands. It doesn't work properly though and it prevents the TreeList from collapsing the node.
  2. Stefan
    Admin
    Stefan avatar
    1131 posts

    Posted 21 Sep Link to this post

    Hello, Matthew,

    The issue occurs because the event is preventable, and the loaded method has to be called inside a setTimeout method.

    Still, please have in mind that this will create a scenario where the TreeList dataSource will think that this model is not loaded and request and append it again. This will create duplicate DOM elements in the TreeList:

    collapse: function(e) {
      setTimeout(function(){
        e.model.loaded(false);
      })
    },

    If the data has to be reloaded, please call the read method of the dataSource to reload the data:

    http://docs.telerik.com/kendo-ui/api/javascript/data/datasource#methods-read

    Regards,
    Stefan
    Progress Telerik
    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.
  3. Matthew
    Matthew avatar
    4 posts
    Member since:
    Sep 2017

    Posted 21 Sep in reply to Stefan Link to this post

    Thanks! This works. But it seems to collapse all the rows when I collapse one row and call the datasource read method. Is there a way to do this that doesn't refresh the whole treelist view?

     

    Stefan said:Hello, Matthew,

    The issue occurs because the event is preventable, and the loaded method has to be called inside a setTimeout method.

    Still, please have in mind that this will create a scenario where the TreeList dataSource will think that this model is not loaded and request and append it again. This will create duplicate DOM elements in the TreeList:

    collapse: function(e) {
      setTimeout(function(){
        e.model.loaded(false);
      })
    },

    If the data has to be reloaded, please call the read method of the dataSource to reload the data:

    http://docs.telerik.com/kendo-ui/api/javascript/data/datasource#methods-read

    Regards,
    Stefan
    Progress Telerik
    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.
  4. Stefan
    Admin
    Stefan avatar
    1131 posts

    Posted 22 Sep Link to this post

    Hello, Matthew,

    As the issue seems to be on our end based on the documentation. We will check if the scenario is no longer supported or this is an issue with the current version of the control.

    As the same topic is in another forum post, I will add the answer there to avoid duplicates:

    http://www.telerik.com/forums/treelist-reload-node-on-expand

    Thank you in advance for the patience.

    Regards,
    Stefan
    Progress Telerik
    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.
Back to Top