Abdul Rehman Yawar Khan
Abdul Rehman Yawar Khan

Reputation: 1087

Bind view listener to Controller in Extjs

My question is very basic but somehow I am not able to figure out a solution to it. I have a view, Its xtype is gridPanel. It's id is 'mainGrid'. On its listener method, I have a 'itemdblclick' registered. Now I want to move this 'itemdblclick' inside a controller. I did this but it is not working.

Ext.define('PfalzkomApp.controller.Main', {
    extend: 'Ext.app.Controller',


     init: function() {
        this.control({

            '#mainGrid': {
                  itemdblclick: function(dv, record, item, index, e) {

                   // My logic is here
                }
             }
    });
     }

});

Also how I link my view to this controller? I know how to do it in Extjs 5 but not in ExtJs4.2.

Kindly help.

Upvotes: 0

Views: 1202

Answers (1)

Manish Shakya
Manish Shakya

Reputation: 26

Check your id, i.e grid id. And, also put itemId as same as id.

Ext.define('PfalzkomApp.controller.Main', {
    extend: 'Ext.app.Controller',
    view:[''], //your view

    onMainGridItemDbClick: function(dv, record, item, index, e) {
        alert('this is alert');  
     },  
     init: function() {
        this.control({

            '#mainGrid': {
                  itemdblclick: this.onMainGridItemDbClick
             }
       });
     }

});

Upvotes: 1

Related Questions