View Full Version : Change color for synched rows in a grid

9 Oct 2012, 1:17 PM

I have a grid panel that can be synched to a store by a user pressing a button. By default, only the records that have been changed by the user are sent to the store (only dirty records sent). I am using the synch() function on the store to synch up the grid to the store.

I'd like to change the color of the records (entire row) in my grid panel to something other than its current color if the record was successfully synched to the store. I already have viewConfig:getRowClass function set up but I could not figure out how to determine if a record was just synched (successfully) in this manner. How would one go about doing this? Is this an arduous task?



9 Oct 2012, 1:53 PM
You may have to do some digging around in the the code to see what records have been updated on the sync.

Starting point... have a look at:

Ext.data.AbstractStore :: sync: function() ;

operations = {},
toCreate = me.getNewRecords(),
toUpdate = me.getUpdatedRecords(),
toDestroy = me.getRemovedRecords(),



9 Oct 2012, 4:07 PM
Thanks Scott,

Took a look at those functions. According to the documentation, the getUpdatedRecords returns records that are "to be" updated (aka: not synched via the proxy just yet). I'm assuming after the sync function returns it would have been too late to capture these records as they would have already been synched in the proxy.

I couldnt find any callback method with the sync method that gets called prior to the proxy being synched either. The only thing I can see that may help is the beforesync event. Would that do me any good?

Thanks for your input,


9 Oct 2012, 6:53 PM
You can add a boolean field into your model definition. On store loading, server side script return all records with this field set to false. On updating, server will return updated records with this field set to true. Basing on this field, you render grid rows respectively.

12 Oct 2012, 1:06 PM
Thats it worked perfectly. I actually had a similar boolean already in my Models that specifies the records source (user entry, automatic, cane from server, etc), so I'm surprised I didnt think of this :). Thanks for your help.