0

I found the way to implement listeners for components in EXTJS MVC. But I cannot find the way to add listeners for grid plugins at controller.

1

3 Answers 3

0

not sure if it can help you, I my self now use ComponentQuery directly to retrieve currently edited field.. check it..

ExtJS 4 - How to listen event of each field within roweditor inside controller

0
0

The below example worked for me. That is to say, I can now handle plugin events in my controller. Since I was developing a custom plugin and you are using a packaged plugin, your approach will be a little different. I think you should extend the plugin that you want to use, adding the "mixins" and "relayEvents" concepts from my example. You could also create an override for the plugin you are using.

Ext.define( "Ext.ux.MyController", {
    extend: "Ext.app.Controller",
    init: function() {
        this.control( {
            "mycomponentxtype": {
                "load": function(){ ... },
                "unload": function(){ ... }
            }
        } )
    }
} );


Ext.define( "Ext.ux.MyPlugin", {
    extend: "Ext.AbstractPlugin",
    alias: "plugin.myplugin",

    mixins: [
        "Ext.util.Observable"
    ],

    config: {
        ...
    },

    init: function( myComponent ) {
        var me = this;  

        // contruction of the mixin is required.
        me.mixins["Ext.util.Observable"].constructor.call( me );

        myComponent.relayEvents( me, [ "load", "unload" ] );

        .
        .
        .
    }
} );

Even though the original question is from early 2013. I came to this post in mid-2014 in search of an adequate answer and did not find it. This is essentially how I solved my problem. I hope it helps!

0

This has been answered, though specifically for rowEditing plugin, it should be applicable to any plugin: Ext JS 4 - How to control rowEditor inside controller

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.