0

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.

1 Answer 1

1

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
             }
       });
     }

});
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks it helped. Another thing I was missing was that I forgot to add this controller in Application.js. After doing that this code works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.