Ensuring the selected item in a sencha touch list is always visible.
April 30th 2012Sencha Touch “Ext.List” lists are nice and flexible but they have one fiddly problem. If you manually set the selected item in a list from a callback like so
card.on
activeitemchange: (card, item, oldIndex)=>
index = card.items.indexOf(item)
# Change the list selection to reflect
# the current card
list.select(index)
where list is a currently defined Ext.List object then all works fine until you select an item that is not currently in the visible window. Grrrrrr it is not visible and there is no public API to help you keep it so.
For example my setup is a card layout on the right and a list on the left reflecting the current card.
To select a card you can either directly select an item from the list or proceed sequentially back and forth using the left and right arrow on top of the card…
