请教 grid remoteSort 无效问题!!!!!!

使用了Grid,以及PagingToolbar,点击Grid的列头,排序只能是本页内数据的排序,想达到对整体数据的排序的效果,使用了remoteSort属性,但是发现加入“remoteSort: true”后不仅不能实现预期的功能,而且连本页数据排序功能都失效了,请各位大侠指点!

注: 在不加“remoteSort: true”的情况下,可以达到本页排序的功能

代码如下:

Ext.onReady(function(){
    Ext.QuickTips.init();
   
    var xg = Ext.grid;

    var ds = new Ext.data.Store({
        proxy: new Ext.data.ScriptTagProxy({
             url: 'getMsg.php'   
        }),
               
         reader: new Ext.data.JsonReader({  
            root: 'results',
            totalProperty: 'total',
            id: 'did',
            fields: [
     {name: 'did', mapping: 'did',type:'int'},
     {name: 'aler_type', mapping: 'aler_type'},
     {name: 'device', mapping: 'device'},
     {name: 'class', mapping: 'class'},
     {name: 'content', mapping: 'content'},
     {name: 'dec_tm', mapping: 'dec_tm'},
     {name: 'user', mapping: 'user'},
     {name: 'prc_tm', mapping: 'prc_tm'},
     {name: 'rec_status', mapping: 'rec_status'}
               ]    
        })         
        ,remoteSort: true    });
        ds.setDefaultSort('did', 'DESC');   
 
       
    var sm = new xg.CheckboxSelectionModel();
    var colModel = new Ext.grid.ColumnModel([
    //sm,
    new xg.RowNumberer(),
      {header:'序列号',sortable:true,dataIndex:'did',type:'int'}
      {header:'告警类型',width:80,sortable:true,dataIndex:'aler_type'},
      {header:'设备', width:100,sortable:true,dataIndex:'device'},
      {header:'告警分类',width:75,sortable:true,dataIndex:'class'},
      {header:'告警时间',width:100,sortable:true,dataIndex:'dec_tm'},
      {header:'告警内容',width:250,sortable:true,dataIndex:'content'},
      {header:'处理人',width:60,sortable:true,dataIndex:'user'},
      {header:'处理时间',sortable:true,dataIndex:'prc_tm',type:'date'},
      {header:'消息状态',sortable:true,dataIndex:'rec_status'}                   
              ]);
    //colModel.defaultSortable = true;         

    var grid = new Ext.grid.GridPanel(
    {                            
         loadMask: {msg:'正在加载数据,请稍侯……'},
         region:'center',
         ds: ds,
         cm: colModel,
         autoScroll: true,
         border:false,
         viewConfig: {forceFit:true },       
          bbar: new Ext.PagingToolbar({
      pageSize: 30,
               store: ds,        displayInfo: true,        displayMsg: '显示记录【 {0} - {1}】 共 【{2}】 条记录',       emptyMsg: '无查询记录!',
      items:[
                '-', {
                pressed: true,
                enableToggle:true,
                text: 'Show Preview',
                border:false,
                cls: 'x-btn-text-icon details'//,
               
            }]
})
    });
   
   

var viewport = new Ext.Viewport({
  layout:'border',
  border:false,
  items:[
      {
             region:'center',
             layout:'border',
             border:false,
             items:[ grid ]
      }
  ]
});
 
    grid.render();
    ds.load({params:{start:0, limit:30}}); 

   
})

你可能感兴趣的:(JavaScript,sql,json,PHP,ext)