Problems with refresh function for page, in Appcelerator

匆匆过客 提交于 2019-12-01 09:14:24

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);
)();
arun

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!