extjsextjs3extjs-grid

show Popup(do you want to save changes?) while row change in grid extjs3


want to show popup (like.. Do you want to save changes?) while row change of grid and pop Up have buttons like YES and NO, if previous row is modified and user click on "YES" in popup at that time previous row will be selected till user will not save it and if user click on "NO" at that time remove previous row changes and select next row.


Solution

  • If you are using Ext.grid.plugin.CellEditing to edit rows.

    You need to listen on beforeedit event and commit/reject the changes with combine with Ext.Msg.confirm to prompt.

    Like:

    plugins: [{
        ptype: 'cellediting',
        listeners: {
            beforeedit: function (editor, context) {
                Ext.Msg.confirm("Confirmation", "Confirm to save",
                function (btn) {
                    if (btn === "yes") {
                         context.record.commit();
                    } else {
                         context.record.reject()
                    }
                });
            }
        }
    }]