+ -
当前位置:首页 → 问答吧 → extjs Ext.grid.Panel panel.getForm.load();数据加载

extjs Ext.grid.Panel panel.getForm.load();数据加载

时间:2011-09-02

来源:互联网

帮我看看为何我总是出现错误,把 autoLoad: true,去掉了没错误,但是获取不到数据。加上的话就会出现
\u83F1 is not defined错误,是什么导致这样的错误呢?急救呀!

Ext.define('S3.Console.Envirrecord', {
  constructor: function (dept_id, dept_desc, sensor_id, sensor_desc) {


  var store = new Ext.data.JsonStore({
  model: 'envirrecordmodel',
  pageSize: 15,
  autoLoad: true,
  proxy: {
  type: 'webservice',
  url: 'core/WebService.asmx/LoadEnvirrecord',
  reader: {
  type: 'json',
  root: 'data'
  //totalProperty: 'totalProperty'
  }
  }
  });


  store.on('beforeload', function (store, operation) {
   
  operation.params = { sensor_id: sensor_id, dept_id: dept_id};
  });
  var grid = Ext.create('Ext.grid.Panel', {
  store: store,
  layout: 'fit',
  //method: 'GET',
  width: 200,
  columns: [
  {
  text: '乡镇名称',
  dataIndex: 'dept_desc',
  width: 100
  }, {
  text: '探头编号',
  dataIndex: 'sensor_desc',
  width: 100
  }, {
  text: '冰箱品牌',
  dataIndex: 'refrigerator_brand',
  width: 60
  }, {
  text: '冰箱类型',
  dataIndex: 'refrigerator_brand',
  width: 50,
  renderer: renderDateTime
  }, {
  text: '冰箱型号',
  dataIndex: 'Model',
  width: 100
  }, {
  text: '耗能',
  dataIndex: 'Energy_dissipation',
  width: 50,
  renderer: renderDateTime
  }, {
  text: '容积',
  dataIndex: 'Volume',
  width: 50
  }, {

  text: '使用年限',
  dataIndex: 'refrigerator_life',
  width: 80
  }, {

  text: '维修次数',
  dataIndex: 'repairnum',
  width: 80
  }, {

  text: '备注',
  dataIndex: 'marks',
  width: 100
  }
  ]
  });

   
  var win = Ext.create('Ext.Window', {
  title: '仓储环境' + ' 部门:' + dept_desc + '(' + dept_id + ') 探头:' + sensor_desc + '(' + sensor_id + ')',
  layout: 'fit',
  modal: true,
  width: 800,
  height: 500,
  autoScroll: false,
  items: grid
  });
  win.show();

  }
});

作者: guo779820919   发布时间: 2011-09-02

你加载要用到参数的是吧。 autoLoad: true,的话他没有参数啊。

作者: myShow0001   发布时间: 2011-09-09

JScript code

///你用的应该是EXT4.0吧,改下语法试试
 var store = Ext.create('Ext.data.Store',{
  model: 'envirrecordmodel',
  pageSize: 15,
  autoLoad: true,
  proxy: {
  type: 'webservice',
  url: 'core/WebService.asmx/LoadEnvirrecord',
  reader: {
  type: 'json',
  root: 'data'
  //totalProperty: 'totalProperty'
  }
  }
  });


作者: c3716317   发布时间: 2011-09-09