I gain some experience in understanding the new Titanium Alloy version 3.2.x that has an MVC structure and appeared fairly easy. Now, since I mastered making listview and switching window views, I'm trying to make a button functionality that allows you to add 1 new item. I create a var for list section and took the value from list section ID so that I could manipulate and test it for on item click to check item number. By using the list section variable, now, I'm making an on-click button function for adding 1 new item.
var args = arguments[0] || {}; //----------[ Variables ]---------- var section = $.location_section; // --> ID of the List Section tag. var list = $.location_list_view; $.location_list_view.allowsSelection = true; // --> For iOS. //----------[ Button Click Event Listeners ]---------- function itemClick(e) { // $.location_list_view.sections[e.sectionIndex]; // alert("List Item no. " + section.getItemAt(e.itemIndex)); // var win = Alloy.createController('geo_fence_view'); // win.getView().open(); section.getItemAt(e.itemIndex); alert("List Item no. " + e.itemIndex); } function breakButton(e) { // var win = Alloy.createController('break_menu_view'); // win.getView().open(); // section.setItems($.location_list_view.getTemplates().); var tmp = { properties: { template: "location_template", class: "location_item", location: { text: "RESERVE Y" } } }; section.items = tmp; list.setSections(section);x // list = Titanium.UI.createListView(section); }I tried cleaning it, running it, testing it onto an Android emulator powered by Genymotion and when I tried testing the button for adding 1 new item (temporarily named "BREAK"), it didn't add new list item. Is there a way or something that I could fix this bug by something like updating after adding 1 new item? Please help.