How to detect if the store of a grid has changed or is dirty?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    How to detect if the store of a grid has changed or is dirty?

    I have a forum which has 4 expandable subtabs and one of them has a grid.In this function below I am checking if the tabs have been modified/changed or are "dirty" to be able to save the main tab.

    To add items to the grid, I have seprate window that comes up and saves the item to the grid. However the grid items haven't been saved to the database yet, because the main tab isn't saved yet. So the PK's/ propertyId's of those records are negative right now. So I thought if I check if the store is negative I will then trigger the save function in the backend. It is working, however now, there is an issue where my function is checking all the comboboxes since they all have stores. Is there a way to only check the store of the grids instead of all stores that exist on my forum? I have this function used in a lot of places and I don't want it to cause performance issues by checking all comboboxes stores. I only want to check the stores of grids if they exist.

    	function hasDirtyChild(cnt) {
    		if (!cnt)
    			return false;
    		var ret = false;
    		Ext.each(cnt.query('*'), function (item) {
    			if (item.isDirty && item.isDirty()) {
    				ret = true;
    			if ( {
    				for (var i = 0; i <; i++) {
    					var record =;
    					if (record.get(record.idProperty)< 0) {
    						ret = true;
    		return ret;
    Last edited by fabricio.murta; Apr 02, 2019 at 7:47 PM.

Similar Threads

  1. [CLOSED] insert to grid store not showing red dirty flag
    By susanz in forum 4.x Premium Help
    Replies: 3
    Last Post: Jun 27, 2017, 2:50 PM
  2. [CLOSED] How to detect datefield changed
    By jchau in forum 2.x Premium Help
    Replies: 1
    Last Post: Sep 27, 2013, 9:50 AM
  3. Replies: 4
    Last Post: Mar 13, 2013, 1:34 AM
  4. Replies: 2
    Last Post: Jun 06, 2012, 9:27 PM
  5. [CLOSED] detect new store record on client side
    By pschojer in forum 1.x Premium Help
    Replies: 1
    Last Post: Jul 14, 2009, 9:42 AM

Tags for this Thread

Posting Permissions