Sencha Touch itemtap

后端 未结 2 1502
清歌不尽
清歌不尽 2021-01-05 09:13

I have a list of contacts that sencha touch is displaying in a list. Then when you click a name in the list it should slide to the right and say Hello {contact name}! but wh

2条回答
  •  时光说笑
    2021-01-05 09:41

    The first argument passed to the itemtap event isn't the record of the List item tapped, it's the DataView itself.

    From the docs:

    itemtap : ( Ext.DataView this, Number index, Ext.Element item, Ext.EventObject e ) Fires when a node is tapped on

    Listeners will be called with the following arguments:
    this : Ext.DataView
        The DataView object
    index : Number
        The index of the item that was tapped
    item : Ext.Element
        The item element
    e : Ext.EventObject
        The event object
    

    You can grab the tapped record by using:

    dataView.store.getAt(index); // where 'dataView' is 1st argument and 'index' the 2nd
    

提交回复
热议问题