Application type: Mobile Titanium SDK: 3.2.0 Platform & version: Andriod 4.0.2 Device : Andriod Emulator Host Operating System: Windows 8.1 Titanium Studio: 3.2.0.201312191547
Hi Guys we need to get the info from the selected listview item.
XML <ListView id="parcels" itemclick="getSelectedItem" defaultItemTemplate="template"> <Templates> <ItemTemplate name="template"> <Label left="10" bindId="parcelNumber" id="parcelnumber" /> <Label left="100" bindId="status" id="status" /> </ItemTemplate> </Templates> <ListSection headerTitle="Parcels"> <ListItem parcelNumber:text="AD654321" status:text=" : Loaded "/> <ListItem parcelNumber:text="AD654322" status:text=" : HUB"/> <ListItem parcelNumber:text="AD654323" status:text=" : HUB"/> <ListItem parcelNumber:text="AD654324" status:text=" : Loaded "/> <ListItem parcelNumber:text="AD654325" status:text=" : HUB"/> </ListSection> </ListView>
JS
function getSelectedItem(e) { var section = $.parcels.sections[e.sectionIndex];
var item = section.getItemAt(e.itemIndex);
if(item.properties.title == 'Delivery')
{
alert('Going to Deliver');
}
else if(item.properties.title == 'Collection')
{
alert('Going to Collect');
}
};