I am using setData to add rows to my table view. I thought using setData would clear whats already in the table and then reload it with the array I pass to setData???
Right now if I have Row1 and Row2 in the table and use setData for Row3 and Row4 I get Row1, Row2, Row3 and Row4 all added instead of just Row3, Row4 in the table.
Is there a way to clear the table first and then use setData again for the new rows.
I have tried passing in an empty array in the setData function but that doesn't seem to work.
Did your clear the array? Look to the kitchensink reload example. In general this should work:
var arr = ; arr.push(row1); arr.push(row2); tableview.setData(arr); // reload arr = ; // deleting the array! arr.push(row3); arr.push(row4); tableview.setData(); // you can do that, but don't have to... tableview.setData(arr);
Yes, I got it.
data = [ ];
Like Sven mentioned, make sure the array is clear of all data before pushing more data to it. You can also clear the data on tble.setData();
Can you please let us know how you solved it?