for loop - Marking items in a listview then looping through them to grab checked items properties -


i have code here:

$.clientlist.addeventlistener('itemclick', function(e){     var item = e.section.getitemat(e.itemindex);     var items = e.section.getitems();      if (item.properties.accessorytype == ti.ui.list_accessory_type_none) {         item.properties.accessorytype = ti.ui.list_accessory_type_checkmark;     }     else {         item.properties.accessorytype = ti.ui.list_accessory_type_none;     }     e.section.updateitemat(e.itemindex, item);    }); 

which allows me check , uncheck items in listview. want to, after user done checking items listview. grab values of item.properties.clientname , item.properties.clientid listview.

how do this? want loop through listview , grab selected items of listview.

thanks, kenny

function convertlisttoarrayofclients(list) {     var sections = list.sections,         retval = [];     for(var = 0, il = sections.length; < il; i++) {         var section = sections[i],             items = section.items;         for(var j = 0, jl = items.length; j < jl; j++) {             var item = items[j];             retval.push({                 clientid: item.properties.clientid,                 clientname: item.properties.clientname,                 checked: item.properties.accessorytype == ti.ui.list_accessory_type_checkmark             });         }     }     return retval; } var arr = convertlisttoarrayofclients($.clientlist); 

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -