EXTJS 4 sortInfo在JsonStore中不起作用

时间:2013-12-12 22:53:31

标签: extjs

Ext.define('RouteSeqModel', {
    extend: 'Ext.data.Model',
    fields: [{name: '_id', type: 'number'}, {name: 'Route_Seq' , type: 'int'},'Location_Name','Location_ID','Route_ID']
});

var RouteSeqStore = Ext.create('Ext.data.JsonStore', {
    model: 'RouteSeqModel',
    storeId: 'RouteSeqStore',
    autoLoad: false,
    sortInfo: { field: "Route_Seq", direction: "ASC" },
    proxy: {
        type: 'ajax',
        url: 'get-routeseq.php',
        api: {
                create: 'insert-routeseq.php',
                update: 'update-routeseq.php',
            },
        actionMethods: 'POST',
        baseParams: {
                _id : 0,
            },  
        reader: {
            type: 'json',
            idProperty: '_id'
        },
        writer: {
            type: 'json',
            id: '_id'

         }
    }
});

Ext.define('MyApp.view.MyGridPanelRouteSeq', {
    extend: 'Ext.grid.Panel',
    id:'MyGridPanelRouteSeq',
    alias: 'widget.mygridpanelrouteseq',
    renderTo: Ext.getBody(),
    height: window.innerHeight,
    width: window.innerWidth/2,
    title: 'Route Sequence Setting',
    sortableColumns: false,
    store: RouteSeqStore,

    columns: [
        {
            xtype: 'gridcolumn',
            width: 70,
            dataIndex: 'Route_Seq',
            text: 'Sequence'
        },
        {
            xtype: 'gridcolumn',
            width: 160,
            dataIndex: 'Location_Name',
            text: 'Location Name'
        }]
})

enter image description here

序列从Route_Seq读取数据,但该列仍未排序。

我不知道网格怎么还没有排序..为什么?

1 个答案:

答案 0 :(得分:4)

你从哪里得到sortInfo?它不是有效的商店配置。

你想:

sorters: [{
    property: 'Route_Seq',
    direction: 'DESC'
}]