Search code examples
javascriptextjsextjs4.1roweditor

Extjs 4.X RowEditor trigger 'update' button


The RowEditor plugin on my grid works well but for one my use case I have to trigger the 'update' button programmatically and close the popped up RowEditor panel. For reference, below screenshot:

enter image description here

I have tried below command but it does not seem to trigger the event.

var updtBtn = grid.getPlugin('myPlugin').editor.floatingButtons.child('#update');
myBtn.fireEvent('click', myBtn);

I have created a fiddle to test this: fiddle for RowEditor update firevent

The above command (which did not work) gets executed on below steps:

  1. Click on a row to edit, change the text, do not close the editor popup.
  2. Now click on the 'Add' button on the grid header, which will add a row. This is also when update button fire event need to trigger as per the command I used.

Any pointers on how to get this working is much appreciated.


Solution

  • To make your edit complete you need to use grid.getPlugin('myPlugin').editor.completeEdit(); instead of myBtn.fireEvent('click', myBtn);.

    Look on fiddle: https://fiddle.sencha.com/#view/editor&fiddle/330o