TreeList - how to remove all rows

3 posts, 0 answers
  1. Dave
    Dave avatar
    10 posts
    Member since:
    Nov 2015

    Posted 07 Mar Link to this post


    I have a TreeList which I display rows of data and child data.  I want to click a button and fire off a javascript call to completely clear the TreeList.  I have tried various things and have googled this issue but have not found a solution.  I'm surprised there is not a method for this, something like:

    var treelist = $("#myTreeList").data("kendoTreeList");


    Is there such a function/method?

    I have the buttonClick event no problem but just need the code for deleting all the rows. Can you tell me how to do this please?

    Thank you very much...



  2. Patrick
    Patrick avatar
    173 posts

    Posted 07 Mar Link to this post

    Hello Dave,

    Please take a look at this Telerik Dojo which shows how to clear a datasource, which in turn clears all rows.  

    The method I used was .setDataSource, and I set data to an empty array:
    //Clear DataSource
    $("#btnClear").click(function() {
    var treelist = $("#treelist").data("kendoTreeList");

    //empty datasource
    var emptyDataSource = new{
      data: []

    //setting the datasource of the treelist
    Hopefully, this helps.

    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Kendo UI is VS 2017 Ready
  4. Dave
    Dave avatar
    10 posts
    Member since:
    Nov 2015

    Posted 07 Mar in reply to Patrick Link to this post


    Thanks very much for the quick reply.  That worked.  Thanks for the code snippet!


Back to Top