Get index of clicked tableRow
Hi,
i want to get the index of my clicked row (e.g. my picker contains 20 rows, i want to know which one i clicked).
I tried it like this:
cityPicker.addEventListener('change',
function(e) {
Ti.API.info(e.index);
if (e.index >= 7){
searchCity = e.row.id;
}
)};
My output of the API.info is <null>.
Someone who can help me?
4 Answers
-
Can you post more of your code, are you using multiple columns?
-
Sure ;)
My picker:
var cityPicker = Titanium.UI.createPicker({ selectionIndicator: true, type: Titanium.UI.PICKER_TYPE_PLAIN, top: 40 });My array :
... cityData[7] = Titanium.UI.createPickerRow({ title: 'FooTown', id: 48 }); cityData[8] = Titanium.UI.createPickerRow({ title: 'Bar-City', id: 3 }); ...And i add the Data via:
cityPicker.add(cityData); -
Ah, i got it:
e.indexis wrong…
i have to usee.rowIndex -
Ah, i got it:
e.indexis wrong…
i have to usee.rowIndex