尽管在列模式表格中设置了排序为true,但是当此列值中有空值的话,点击排序不准确。
var store = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url:'userlevel' ,
scripts:true
}),
reader: new Ext.data.JsonReader({
totalProperty: 'rowCount',
root: 'root',
fields: [
{'userlevel'} ]
})
});
var cm = new Ext.grid.ColumnModel([
new Ext.grid.RowNumberer(),//显示行号
{header:'积分',dataIndex:'userlevel',
sortable:true,width:80,renderer:renderNull},
据说ext内部排序是按照ASCII来的...俺米有看过源码....还处于初步接触ext的状态....
解决办法:
var store = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url:'userlevel' ,
scripts:true
}),
reader: new Ext.data.JsonReader({
totalProperty: 'rowCount',
root: 'root',
fields: [
{name:'userlevel',type:'string'} ]
})
});
将fields中的参数指定type(数据类型)。
API中的值是:
type : String
(Optional) The data type for conver...
(Optional) The data type for conversion to displayable value. Possible values are
- auto (Default, implies no conversion)
- string
- int
- float
- boolean
- date