Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8937801
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:28:42+00:00 2026-06-15T10:28:42+00:00

I have a GridPanel and within the toolbar I have two buttons Reject Changes

  • 0

I have a GridPanel and within the toolbar I have two buttons “Reject Changes” and “Save Changes”. The code below shows what each button does, and so far things work as expected.

Ext.define('APP.view.MyGrid' ,{
    extend: 'Ext.grid.Panel',

    ...

    initComponent: function() {    
        var me=this;
        me.store = myStore;         
        me.plugins = [
            Ext.create('Ext.grid.plugin.CellEditing', {
                clicksToEdit: 1, autoCancel: false
            }),
        ];          
        me.rejectBtn = {
            xtype:'button', id:'kbsGridCancelBtn', text:'Reject changes',
            handler: function() { me.store.rejectChanges(); }
        },      
        me.saveBtn = {
            xtype:'button', id:'kbsGridSaveBtn', text:'Save changes',
            handler: function() { me.store.sync(); }
        },      
        me.bbar = Ext.create('Ext.toolbar.Toolbar', {
            items : [{ xtype: 'tbfill'},me.rejectBtn,'-',me.saveBtn] 
        });

        me.callParent(arguments);
    }

    ...

});

How to enable/disable the buttons (or any other action) only if the grid data has been modified by the user? I.e. only if any grid row/field becomes dirty (and vice-versa)? Which listener(s) should my code be listening to?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T10:28:43+00:00Added an answer on June 15, 2026 at 10:28 am

    As shown in the question there’s a CellEditing plugged-in to the Grid. By listening to the CellEditing Plugin’s validateedit event, which is fired when data in the grid is changed, one can use the event’s parameters to update the store’s row using the Model instance’s set function. Of course after the required validation is done. The code decides whether to enable/disable the buttons based on what getModifiedrecords returns.

    Code:

    ...
    
    listeners: {
        'validateedit': function(cep, e, eOpts) {
            var me = this,            
                rowIdx = e.rowIdx, // row index
                fieldName = e.field,
                newVal = e.value,
                storeRow = this.store.getAt(rowIdx);
    
            // assuming valid input, proceed with the below    
            storeRow.set(fieldName, newVal);
    
            // if modified records > 0 then enable buttons
            var enableButtons = Boolean(me.store.getModifiedRecords().length);
    
            if (enableButtons) {
                /* enable buttons */
            } else { /* disable buttons */ }        
    
        }, scope: this
    }
    
    ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code within my .aspx file <ext:GridPanel runat=server ID=GridPanel1 Height=450 Title=EmployeeList
I have GridPanel with toolbar on it with many buttons. All buttons can't stand
I have some buttons in a bottom toolbar of a gridpanel that control adding,
Using 4.0.6 I have a gridpanel with an actioncolumn that has two items, a
I have an ext js grid like below: var grid = new Ext.grid.GridPanel({ columns:
I have ext.net GridPanel on the page. GridPanel contains a button. How to force
I have trouble using scope in nested functions. My code is below and also
I have put a button on a dataGrid with the following code column is;
I have a GridPanel with just two columns: names and commission percentages. The sum
I have implemented a gridpanel using Extjs that shows the content of a database.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.