I'm trying to use the Grid Editing plug-in in ExtJS 4.2, but I'm having a problem using the cancelEdit method. I have a similar configuration to the Writer example at http://docs.sencha.com/ext-js/4-2/extjs-build/examples/writer/writer.html, and the issue also appears to be occurring in that example.

The listener for the click event of the "Add" button calls the cancelEdit method of the editor plugin. This should cancel any changes made in the currently active cell. However, calling this method doesn't appear to do anything. Instead, it completes the edit to the cell just as it would if the cancelEdit method was not called at all.

I have tried adding a listener for the "canceledit" event, and this does not fire when the cancelEdit method is called manually.

To see how it should behave, try making a change in the cell and tap the Esc key on your keyboard. The change you made will be reverted. This appears to call the cancelEdit method, and the canceledit event is fired as you would expect.

Any ideas?

Thanks,
Joe

slemmon

5 Apr 2013, 1:42 PM

When you blur the editor field by clicking the Add button it commits the edit. So, in this instance the editing isn't cancelled as it's already been completed by the time the Add button's click has been processed.

joelennon

5 Apr 2013, 2:26 PM

Thanks for that, makes sense.

Any suggestions on alternative approaches to this? Maybe disabling the Add button when cell editing is active?

slemmon

5 Apr 2013, 2:32 PM

That might work. You can certainly have your button state managed using keying off of the beforeedit and edit (or validedit) events.