selectindexingmobiscroll

Mobiscroll - Selected Item Index


How would I get the index of the selected Mobiscroll Item? I am using the 'select' option. onClose calls function(valueText, btn, inst) and onChange calls function(valueText, inst). I can get the 'display' text, button, inst, etc., but not the index of the selected item.

On the Scroller I am displaying the file names in a formatted manner. I need to use the index to get the correct filename from an array. How do I get the index? :-)

Any suggestions?

Thanks a ton. M&M


Solution

  • Ok I found an easy way out. When I am adding items to Mobiscroll, I also populate an array with the same values. Then all I need to do is "var selected_index = myArray.indexOf(valueText);" and I can get the index of the selected item. The first item index will be a 0. And I can use this in both onClose as well as onSelect events of Mobiscroll. Thanks a ton anyways guys!