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

Clear all Node

3 Answers 20 Views
TreeList
This is a migrated thread and some comments may be shown as answers.
Matteo Fabris
Top achievements
Rank 2
Matteo Fabris asked on 09 Oct 2020, 03:43 PM

Hello,

I have a problem with reloading data in my Kendo Treelist.

I have a div <div id="#treeview-div"></div>

when I bind data, I call LoadData function.

When I call the function for the 1° time, all works well.

When I call the function for the 2° time, hiearchical row doesn't work.

 

How can I clear my div and rebind without issue?

 

Thanks

LoadData = function (dati)
{
     
    $("#treeview-div").empty();
 
     
             
    dati.schema = {};
    dati.schema.model = {};
    dati.schema.model.id = "id";
    dati.schema.model.expanded = false;
    //
    var dataSource = new kendo.data.TreeListDataSource(dati);
                         
             
             
           $("#treeview-div").kendoTreeList({
                        dataSource: dataSource,
                        height: 600,
                        columns: [
                            { field: "DataOra" },
                            { field: "Attivita" },
                            { field: "Progetto" }
                        ]
                    });
}

3 Answers, 1 is accepted

Sort by
0
Anton Mironov
Telerik team
answered on 13 Oct 2020, 02:28 PM

Hello Matteo,

Thank you for the provided code snippet.

I tried locally to reproduce the described behavior and, at my side, the binding function is working as expected. Here is a dojo sample of my implementation:

Use the example above as a template. If the issue persists, replicate, and send it back to me in this thread.

For generating a new dojo link use Ctrl+Shift+S. To save it use Ctrl+S.

Kind Regards,
Anton Mironov
Progress Telerik

Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive, special prizes, and more, for FREE?! Register now for DevReach 2.0(20).

0
Matteo Fabris
Top achievements
Rank 2
answered on 21 Oct 2020, 03:43 PM

Hello.

Thanks for your reply!

Sorry but your example doesn't work in my project.

If I call
var emptyDataSource = [];
    
    var treeList = $("#treeview-div").data("kendoTreeList");
        treeList.setDataSource(emptyDataSource);

Chrome Console raise error: Cannot read property 'setDataSource' of undefined

I use Kendo v2018.2.516.

How can I solve?

thanks!

0
Anton Mironov
Telerik team
answered on 23 Oct 2020, 01:05 PM

Hi Matteo,

Thank you for the provided details.

In order to resolve the faulty behavior try removing the following row from the code:

 

$("#treeview-div").empty();

 

After the change observe the result and if the issue persists, modify the following dojo and send it back to me in this thread:


Best Regards,
Anton Mironov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
TreeList
Asked by
Matteo Fabris
Top achievements
Rank 2
Answers by
Anton Mironov
Telerik team
Matteo Fabris
Top achievements
Rank 2
Share this question
or