tableView.setData() appending data not actually setting it
Hi
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.
Ian
4 Answers
-
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.
I did:
data = [ ];
tableView.setData(data);Thanks
-
Deeksha,
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();
http://www.srcnix.com
-
Hi,
Can you please let us know how you solved it?
Thanks