Search code examples
javascriptandroidtitaniumreload

How to reload tableView in titanium?


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.


Solution

  • This 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);