2013-12-12 55 views
3
工作
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 hereEXTJS 4的SortInfo不JsonStore

序列被读出从Route_Seq中的数据,但该列仍然没有排序尚未。

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

回答

4

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

你想:

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

很多网的,甚至stackflow的回答也用我的SortInfo,但你一个是working.t汉克斯 –

+0

对不起,坏死,职位,但谷歌搜索的时候我也很困惑回答这个。我认为@ChinYe指的是排序的“旧方式”。 [如何在网格中设置默认排序列?](http://www.sencha.com/forum/showthread.php?74558#post_358969) –