Sencha Touch itemtap

后端 未结 2 1501
清歌不尽
清歌不尽 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:37
    itemtap: function(view, index, item, e) {
        var rec = view.getStore().getAt(index);
        ListDemo.detailPanel.update(rec.data);
    }
    

    That's how I got it to work.

    0 讨论(0)
  • 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
    
    0 讨论(0)
提交回复
热议问题