Programatically delete all items clientside

2 posts, 0 answers
  1. Mike
    Mike avatar
    5 posts
    Member since:
    Mar 2014

    Posted 09 Mar 2015 Link to this post

    I've got an all client-side RadListView that I've populated via appendData(items), and add more items via appendData(items) when the user scrolls.

    So, this seems like a simple question to me, but I'm unable to figure out how do I remove all the items from the RadListView and populate it again from scratch?  I need to do this when the user changes various search filters on the page.

    Appending data, and Prepending data works fine - setting the datasource to an empty list and binding or rebinding seem to have no effect.  (Remember this is all client-side and I don't want any post-backs).

    Do I need to destroy and re-create the RadListView itself?

  2. Angel Petrov
    Angel Petrov avatar
    1002 posts

    Posted 12 Mar 2015 Link to this post

    Hi Mike,

    You should be able to clear all the items be executing the following code.

    var listView=$telerik.findControl(document,'RadListView1');
    The above JavaScript will set an empty array as a data source this clearing the records from the control.

    Angel Petrov

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

  3. DevCraft R3 2016 release webinar banner
Back to Top