PDA

View Full Version : update column header style on grid sorting



dmudro
19 Dec 2011, 7:31 AM
I have a 'reset sorting' button in toolbar in my grid so there is ability to explicitly revert to default sorting. there is following click handler function on the button:

onResetSorter: function() {
this.getStore().sort({
property: 'id',
direction: 'DESC'
});
}

this sorts related store and refreshes grid body accordingly, but does NOT update style for column heading with the highlighted background and arrow. any ideas?

thanks

mitchellsimoens
19 Dec 2011, 10:01 AM
The datachanged event will fire when the store is sorted. The data property of the Store is an instance of Ext.util.MixedCollection which fires a sort event, wish that was bubbled to the Store but you could listen for it. I would just stick with datachanged event and see if the Store is sorted and enable/disable or hide/show the button to your liking.

dmudro
19 Dec 2011, 10:09 AM
thanks Mitch. the problem is not in the button though neither in listening for the sorting event but how to set the default column visually active once the button is clicked (column header highlighted with blue background + corresponding arrow)?

mitchellsimoens
19 Dec 2011, 10:31 AM
The column should reflect the store sorting state.