Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var gridCloumn = [
- Ext.create('Ext.grid.RowNumberer',{text: '序号', width: 30}),
- {header: '个数', dataIndex: 'count', width: 70, doSort:function(state) {
- var ds = this.up('grid').getStore();
- var field = this.getSortParam();
- ds.sort({
- property: field,
- direction: state,
- sorterFn: function(v1, v2){
- v1 = v1.get(field);
- v2 = v2.get(field);
- var n1 = new Number(v1);
- var n2 = new Number(v2);
- return n1 > n2 ? 1 : (n1 < n2 ? -1 : 0);
- }
- });
- }}
- ];
- var gridFields = [
- {name: 'id'},
- {name: 'name'},
- {name: 'level',
- sortType: function(value) {
- switch (value){
- case '关键': return 5;
- case '重要': return 4;
- case '中等': return 3;
- case '低级': return 2;
- default: return 1;
- }
- }
- }
- ];
Add Comment
Please, Sign In to add comment