PDA

View Full Version : How to add additional css in grid column header?



pegaso52it
3 Nov 2009, 6:12 AM
Hi all,
I need to add additional css in the column header.
This because my application sorts/filters the data server side, so, when grid is displayed,
I'd like to give user the information about sorted/filtered columns using ExtJS's default styles:
ux-filtered-column
sort-asc
sort-desc

Is there a way to do that?

Thanks.

Condor
3 Nov 2009, 7:16 AM
You can set the sort icon by calling:

gridPanel.getView().updateSortIcon(col, dir);

pegaso52it
3 Nov 2009, 7:34 AM
Hi Condor, thanks for your answer.
I need also to give user the idea of the filtering.
At least I've found this solution:



aCollectionGrid.on('afterrender', function (aGrid) {
var view = aGrid.getView(),
hds, i, len, filter;
if (view.mainHd) {
hds = view.mainHd.select('td')
for (i = 0, len = view.cm.config.length; i < len; i++) {
if (view.cm.config[i]['filtered']) {
hds.item(i).addClass('ux-filtered-column');
}
// here the other conditions for sort
}
}
return false;
});