-
27 Jul 2011 3:16 AM #11
I have add in a new file javascript this code:
After i have create the grid with rowediting with this codeCode:// Override the cancelEdit function of RowEditing plugin to insert canceledit event Ext.override(Ext.grid.plugin.RowEditing, { cancelEdit: function() { var me = this; if (me.editing) { me.getEditor().cancelEdit(); me.callParent(arguments); this.fireEvent('canceledit', this); } me.addnew = false; } });
but when i cancel the record nothing happens!Code:// Create RowEditing plugin rowEditing2 var rowEditing2 = Ext.create('Ext.grid.plugin.RowEditing', { id:'rowEditing2', clicksToEdit: 2 }); // Remove record from store on canceledit from grid using rowEditing2 plugin rowEditing2.on('canceledit', function(me) { if(me.addnew) me.context.record.store.remove(me.context.record); });
-
27 Jul 2011 3:30 AM #12
Try with this first:
Also make sure you are using the right plugin name in ur grid (rowEditing2 here) and have included the new JS file in your HTML file!Code:// Override the cancelEdit function of RowEditing plugin to insert canceledit event Ext.override(Ext.grid.plugin.RowEditing, { cancelEdit: function() { var me = this; if (me.editing) { me.getEditor().cancelEdit(); me.callParent(arguments); this.fireEvent('canceledit', this); } } }); // Create RowEditing plugin rowEditing2 var rowEditing2 = Ext.create('Ext.grid.plugin.RowEditing', { id:'rowEditing2', clicksToEdit: 2 }); // Remove record from store on canceledit from grid using rowEditing2 plugin rowEditing2.on('canceledit', function(me) { me.context.record.store.remove(me.context.record); });
-
29 Jul 2011 12:32 AM #13
Yes!! It work!!
Thanks!!
But i've used this sintax for "cancel" the record:
because if i stay updating a record and press "cancel", this sistem didn't hide the record; while "me.context.record.store.remove(me.context.record)" hide the exists record and "cancel" the new record that was not save.Code:rowEditing2.on('canceledit', function(me) { //me.context.record.store.remove(me.context.record); store.load(); });
Thank You!!!!
-
18 Aug 2011 11:53 PM #14



Reply With Quote