Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Delete all rows in a tableview with a single click

Hi there,

has anyone a good way to "clear" the table?
I want to build a button which deletes all my rows, so that i can add some new data in my tableview.

— asked August 3rd 2010 by Michael Gajda
  • button
  • clear
  • delete
  • iphone
  • mobile
  • table
  • tablerow
  • tableview
0 Comments

1 Answer

  • tableView.setData([])

    — answered December 11th 2012 by Adeel Rizvi
    permalink
    1 Comment
    • or you can do like this way

      var data = [];
      
      // your tableView code where the data is adding in data variable
      
      // your row clear button event write the below code in that :
      
      data = [];
      tableView.setData(data);
      

      — commented December 11th 2012 by Adeel Rizvi
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.