my code is
var tableData=[];
var dict ={};
dict["title"] ='My Title';
tableData[0] =dict;
var table = Ti.UI.createTableView({
data:tableData,
});
self.add(table);
This data is displayed properly.
Then in some function i am updating the array.
var dict ={};
dict["title"] ='My New Title';
dict["hasChild"]=true;
tableData[0] =dict;
And setting table data using setData:
table.setData(tableData);
But there is no changes in tableView, i searched similar questions but din't get any help.
my code is
var tableData=[];
var dict ={};
dict["title"] ='My Title';
tableData[0] =dict;
var table = Ti.UI.createTableView({
data:tableData,
});
self.add(table);
This data is displayed properly.
Then in some function i am updating the array.
var dict ={};
dict["title"] ='My New Title';
dict["hasChild"]=true;
tableData[0] =dict;
And setting table data using setData:
table.setData(tableData);
But there is no changes in tableView, i searched similar questions but din't get any help.
Share Improve this question edited Jul 11, 2018 at 7:53 Cœur 38.8k26 gold badges205 silver badges277 bronze badges asked Mar 20, 2012 at 16:50 PreethamPreetham 1251 silver badge11 bronze badges 1- show some more code .... – Maulik Commented Mar 21, 2012 at 8:34
3 Answers
Reset to default 3This would work... Before you set the updated data, make the tableView empty with a blank array and then update again with new data.
table.setData([]);
table.setData(tableData);
Try to remove first all the objects from the array and then update your array object and after then reload the table with table.setData(tableData);
You can also change the Table Data with table.data = tableData;
In some Cases you need to re-set the Data with table.setData( table.data );