Question

I use Extjs 4.2 and Deftjs.

In my gridpanel view I define a plugin like:

plugins: [
         Ext.create( 'Ext.grid.plugin.CellEditing', {
            clicksToEdit: 1,
            listeners: {}
         } )
      ]

But I do not want to define the listeners and actions in my view, rather in my controller.

So how do I define the listeners for this plugin from my controller?

I tried to define the whole plugin attribute in my controller's constructor:

constructor: function( oConfig ) {
         var that = this;

         Ext.apply( that, oConfig, {
            plugins: [
               Ext.create( 'Ext.grid.plugin.CellEditing', {
                  clicksToEdit: 1,
                  listeners: {
                     edit: function( oEditor, oOptions ) {
                        console.log( oEditor, oOptions );
                     }
                  }
               } )
            ]
         } );

         that.callParent( [ arguments ] );
      },

But thats wrong, I can get the view config that way. I would like the plugin to stay in the view, but define the listeners in my controller.

Was it helpful?

Solution

I did not come up with a solution for my question, but I managed to define the listener's actions in my controller by using:

oView.editingPlugin.on( 'beforeedit', function( a, b ) {
            console.log( a, b );
         } );
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top