Extjs4的Grid是最常用的控件,序号我们一般使用如下代码:
columns:[
{
text:"序号",
xtype: 'rownumberer',
width:40
}
]
这样是1、2、3、4、5....顺序展示
如何倒序展示呢,代码如下:
columns:[
{
text:"诊次",
xtype: 'rownumberer',
width:40,
renderer:function(value,metadata,record,rowIndex){
return this.store.getTotalCount() -((this.store.currentPage-1)*this.store.pageSize)-rowIndex
return
}
}]
这样就可以 ....5、4、3、2、1 展示了
this.store.getTotalCount():grid总数据量
this.store.currentPage:当前页码,从1开始
this.store.pageSize:每页展示的数据量