PDA

View Full Version : RowNumberer DESC?



drian
21 May 2011, 8:21 AM
Does any one have any idea how to make the row numberer list the numbers in a DESC way rather than ASC mode?

thanks

drian
21 May 2011, 9:16 AM
For any one interested, this is what i came up with:

- it has included pagination & DESC support working together. Just add dir = 'DESC' into the configuration to enable desc direction (ASC is standard).



Ext.override(Ext.grid.RowNumberer, {
renderer : function (v, p, record, rowIndex, count, store) {
if (this.rowspan)
p.cellAttr = 'rowspan="' + this.rowspan + '"';

var i = store.lastOptions && store.lastOptions.params ? store.lastOptions.params.start : 0;
if (isNaN(i)) i = 0;

if(this.dir == 'DESC')
return ( (store.getTotalCount() > store.getCount()) ? store.getTotalCount() : store.getCount() ) - i - rowIndex;
else
return i + rowIndex + 1;
}
});