PDA

View Full Version : accessing row editing plugins in controller



nimaous
21 Jun 2012, 7:05 AM
Hi
I add a row editing plugin for my gridpanel .

and I want to handle adding new user in my controller I simply user
var rowediting=this.waiterlist.rowediting;

which waiterlist is a ref to my main panel in my view

but i got this error :
Uncaught TypeError: Cannot read property 'rowEditing' of undefined
is there any way to access the grid panel row editing plugins in controller

redraid
21 Jun 2012, 7:14 AM
Use pluginId config:


plugins: [{
pluginId: 'rowedit',
//plugin options
}]


Use getPlugin method:


var rowediting = this.waiterlist.getPlugin('rowedit'),

nimaous
21 Jun 2012, 7:34 AM
I use getPlugin function but I got this error :

Uncaught TypeError: Cannot read property 'length' of undefined

asahoo
22 Sep 2014, 5:49 AM
I am using rowexpnder Plugin in a grid. I have given the pluginId to the Plug in.

I have a action column in the grid.In the handler of the action column i am trying to access the PlugIn by using grid.getPlugin("pluginId").

but it is showing "can not read property of undefined " error. Any suggestion on this will bne appreciated.

redraid
22 Sep 2014, 5:56 AM
In the handler of the action column i am trying to access the PlugIn by using grid.getPlugin("pluginId").

Can you show code of action handler?

asahoo
22 Sep 2014, 6:10 AM
xtype: 'actioncolumn',


items: [
{

handler: function (grid, rowIndex ) {
var plugin = grid.getPlugin('pluginID');
var rec = grid.getStore().getAt(rowIndex);
plugin.toggleRow(rowIndex,rec);

}
}
]

redraid
22 Sep 2014, 6:51 AM
You mistake in that you think first argument in action column handler is datagrid but it is view. You need get datagrid from view and then get plugin:


xtype: 'actioncolumn',
items: [{
handler: function (view, rowIndex ) {
var grid = view.up('grid');
var plugin = grid.getPlugin('pluginID');
var rec = grid.getStore().getAt(rowIndex);

plugin.toggleRow(rowIndex,rec);
}
}]


Demo: http://jsfiddle.net/8pyg09qd/3/