Titanium SDK version: 1.6.1 iPhone SDK version: 4.2
I am using JavaScript.
I am developing an app that is fetching information from an API. In this app, on t
this is a common architectural problem, you should separate out the function of creating the table and loading the table's data.
you create the table once when the window is created, and you load the data in the table multiple times. Pseudo code below should give you the basic idea.
var win = Ti.Ui.currentWindow;
(function(){
var table;
// create the table
function initializeWindow() {
}
// load the data, and update table
function loadWindowData() {
}
initializeWindow();
loadWindowData();
// called whenever you want to update window data.
Ti.App.addEventListener('app:refreshTable',loadWindowData);
)();
TableView -
table.setData([]); // First Clear
table.setData(tableData); // Updated Content
ListView -
listView.sections[0].setItems([]);//First Clear
listView.sections[0].setItems(tableData); // Updated Content
For Updating Content inside Window you can use "open" listener.
win.addEventListener("open",loadData);