PDA

View Full Version : Reverse numbering for rownumberer



env0ke
19 Aug 2011, 5:08 AM
Hi all,

How i can do reverse numbering for rownumberer?

stevil
19 Aug 2011, 6:21 AM
Hi all,

How i can do reverse numbering for rownumberer?

Try defining:




Ext.define('Ext.ux.grid.ReverseRowNumberer', {
extend: 'Ext.grid.RowNumberer',
alias: 'widget.reverserownumberer',


renderer: function(value, metaData, record, rowIdx, colIdx, store) {
if (this.rowspan){
metaData.cellAttr = 'rowspan="'+this.rowspan+'"';
}


metaData.tdCls = Ext.baseCSSPrefix + 'grid-cell-special';

// reverse the direction of the returned row number by subtracting it off the total
return store.totalCount - store.indexOfTotal(record) + 1;
}
});



and use xtype: 'reverserownumberer' for your row numberer column.

hope this gets you started.

stevil

env0ke
19 Aug 2011, 9:42 AM
Worked for me. Thanks!