user386430
user386430

Reputation: 4967

How to implement click event for panel in sencha touch in controller

Can anybody tell How to implement clickor tap event for panel in sencha touch in controller

Thanks

Upvotes: 0

Views: 331

Answers (2)

Mohit Saxena
Mohit Saxena

Reputation: 1449

Implement tap of Panel like this. It will work.

Ext.define('YourApp.view.text', {
extend: 'Ext.Panel',
xtype: 'text',
initialize: function () {
    this.element.on({
        tap: function () { alert('tapped!'); }
    });
}

});

Upvotes: 0

gautham city
gautham city

Reputation: 50

Ext.define('FirstApp.controller.details', {
extend: 'Ext.app.Controller',

config: {
    stores : ['your store'],
    models : ['your model'],
    refs: {
        myContainer: 'your view'
    },
    control: {
        'your view': {
            activate: 'onActivate',// fires when view is activated
            itemtap: 'onItemTap',// fires when item is tapped
        }
    }
},
onActivate: function() {
    console.log('Main container is active');
},

onItemTap: function(view, index, target, record, event) {
    console.log('Item was tapped on the Data View');
    console.log(view, index, target, record, event);
    Ext.Msg.alert('', 'The user  selected is: ' + record.get('username'));
},

});

Upvotes: 1

Related Questions