Search code examples
javascriptextjs4mouseevent

How to avoid pressing save button twice on an ExtJS grid that uses cell editing


When using ExtJS grids for cell editing there can be an issue of having to click a button twice because the blur event for the editor (a textfield) gets called first and then the first button click event is for some reason no longer accessible. How is it possible to avoid pressing a (save) button twice in this circumstance?


Solution

  • To avoid some bugs that manifested themselves using the other answer I extracted what I needed into it's own xtype as follows:

    Ext.define('Predictive.view.ParamGridSaveButton', {
        extend: 'Ext.button.Button',
        alias: 'widget.paramGridSaveButton',
    
        onMouseDown: function() {
            Predictive.eventBus.fireEvent('dropdownSaveClicked', this);
            this.callParent(arguments);
        }
    });