-
9 Feb 2012 3:10 PM #1Touch Premium Member
- Join Date
- Jul 2011
- Location
- Cuernavaca, Mexico
- Posts
- 51
- Vote Rating
- 1
- Answers
- 2
Answered: MVC RowEditor Cancel Event
Answered: MVC RowEditor Cancel Event
Hello Forum,
I have a simple Grid Panel with the Roweditor plugin and I'm trying to listen to the event canceledit from a controller but it isn't firing.
GridPanel
ControllerCode:Ext.define('Mx.view.grupoListGridPanel',{ extend: 'Ext.grid.Panel', alias: 'widget.grupoListGridPanel', title: 'Grupo', store: 'grupo.queryGrupoAll', plugins: [{ ptype: 'rowediting', clicksToEdit: 2, autoCancel: false }], columns: [ { header: 'ID', dataIndex: 'id' }, { header: 'Nombre', dataIndex: 'nombre', editor: { xtype: 'textfield', allowBlank: false } }, { header: 'Descripcion', dataIndex: 'descripcion', editor: { xtype: 'textfield', allowBlank: false } } ] });
The wierd thing is that the event edit IS firing and according to the documentation its fired by the plugin but it won't work with the event canceledit.Code:Ext.define('Mx.controller.prospectoController',{ extend: 'Ext.app.Controller', models:[ 'grupo.grupoAll' ], stores:[ 'grupo.queryGrupoAll' ], views: [ 'grupoListGridPanel' ], init: function() { this.control({ 'grupoListGridPanel' :{ edit: this.afterGrupoEdit, canceledit: this.onCancelGrupoEdit } }); }, afterGrupoEdit: function(grid){ console.log(grid); console.log('after edit'); this.getGrupoQueryGrupoAllStore().sync(); }, onCancelGrupoEdit: function(){ console.log('cancel'); } });
Am I doing something wrong??
-
Best Answer Posted by vietits
What version of Ext do you use?
- With 4.0.2a: the rowEditor plugin won't fire 'cancelEdit' event at all.
- With 4.0.7: the plugin fires 'cancelEdit' event but the grid won't relay it so your controller can't not catch it.
- 4.1.0-b1: the plugin fires 'cancelEdit' event and the grid relay this event so your controller can catch it.
-
9 Feb 2012 3:59 PM #2
What version of Ext do you use?
- With 4.0.2a: the rowEditor plugin won't fire 'cancelEdit' event at all.
- With 4.0.7: the plugin fires 'cancelEdit' event but the grid won't relay it so your controller can't not catch it.
- 4.1.0-b1: the plugin fires 'cancelEdit' event and the grid relay this event so your controller can catch it.
-
9 Feb 2012 4:17 PM #3Touch Premium Member
- Join Date
- Jul 2011
- Location
- Cuernavaca, Mexico
- Posts
- 51
- Vote Rating
- 1
- Answers
- 2
I'm using Ext 4.0.7
So its a bug ok.
I've managed to do a little work around in the plugin configuration:
Thanks!!!Code:plugins: [{ ptype: 'rowediting', clicksToEdit: 2, autoCancel: false, listeners: { canceledit: function(view){ view.grid.fireEvent('canceledit', this); } } }]
-
8 Sep 2012 1:30 PM #4
Great Job
Great Job
Thank's for this post!


Reply With Quote
