Hello all I need your help to add data in listView. I follow the sample but I don t understand why my data don't go in the listView.
Here's the code :
// Create template var plainTemplateAdress = { childTemplatesAdress: [ { type: 'Ti.UI.Label', // Use a label bindId: 'adress', // Bind ID for this label properties: { // Sets the Label.left property top: 3, left: 10, } }, { type: 'Ti.UI.Label', // Use a label bindId: 'city', // Bind ID for this label properties: { // Sets the Label.left property top: 6, left: 10, } }, ] }; var table = Ti.UI.createListView({ templates: { 'plainAdress': plainTemplateAdress }, defaultItemTemplate: 'plainAdress', top:20, }); var data = []; var sectionAdress = Ti.UI.createListSection(); table.removeAllChildren(); for (var i = 0; i < 10; i++) { data.push({ adress : { text: "Test Adress " + i }, city : { text: "Test City " + i }, }); sectionAdress.setItems(data); } table.sections = [sectionAdress]; win.add(table);I just follow the sample but don't understand why this is not working.
I think the problem is in this part of the code :
for (var i = 0; i < 10; i++) { data.push({ adress : { text: "Test Adress " + i }, city : { text: "Test City " + i }, }); sectionAdress.setItems(data); } table.sections = [sectionAdress];
Anyone can help me ?
Many thanks