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.
3 Answers
-
An easy way to clear all the rows in a table is:
myTable.setData([]);
That said, you only need to do this if you will then be appending or inserting rows to the table. Another alternative is to instead create an array of table rows, then use setData(myArray). This swaps out the previous collection of table rows for the data in they new array.
-
Dough, If I use "myTable.setData([])" all the objects in the table are removed from memory?
-
am also wondering about this one…