Delete all rows in a tableview with a single click (iPhone) - Redux

You must Login before you can answer or comment on any questions.

This question was supposedly answered a few days ago. But, the answer (clearing out the array variable with []) doesn't work. I've got a Tab Bar controller that I'd like to use to control the content of a single table.

My Code: http://pastie.org/1081703

What is happening is those indexes who overlap are being changed (instruments[0-3]) and those that don't still remain in the table. And yes, I did try setData([]).

As always, any help is greatly appreciated.

Titanium 1.2.1, 1.4 SDK iPhone 3G, 4.0.1

2 Answers

No need to do that, although it should work.

Just do this

my_table.setData([]);

It works, I'm using it all the time; it's much faster.

Cheers, Nico

while (my_table.data[0].rows.length > 0) {
my_table.deleteRow(0);
};
 
Wouldn't that do the trick?

Your Answer

Think you can help? Login to answer this question!