extjs4.1 gridpanel 分页查询 自定义参数没法穿到后台,请问如何设置,谢谢!十分感谢

2025-05-13 01:10:22
推荐回答(1个)
回答1:

Ext.create('Ext.data.Store', {
    fields: ['1','2','3'],
    pageSize: 16,
    proxy: {
      type: 'ajax',
      url: 'xxx',
      extraParams: {
        //方法1,在这里添加额外参数,这个,呃,实测时参数多了会是失效
        type: type
      },
      reader: {
        type: 'json',
        root: 'xxx',
        totalProperty: 'xxx'
      }
    },
    listeners: {
      beforeload: function(s) {
        //方法2,添加监听事件
        Ext.apply(s.proxy.extraParams, {
          type: type
        });
      }
    }
  });