sencha-touchsencha-architectsencha-touch-2.1

How to implement listview item tap event in controller in sencha touch


Can anybody tell How to implement listview item tap event in controller in sencha touch

Thanks


Solution

  • Do the following: If your list is like below:

    {
      xtype: 'list',
      name: 'myList',
      store: 'test'
    }
    

    Then your controller will go like this:

    config: {
        refs: {
            myList: 'list[name="myList"]'
        },
        control: {
            myList: {
                itemtap: 'onItemTap' // fires when listitem is tapped
            }
        }
    },
    
    onItemTap: function(view, index, target, record, event) {
        console.log('List Item was tapped of the list view');
        ........ your code goes here .........
    }
    

    Note: These small things you can find in sencha docs.