日期:2014-05-16  浏览次数:20696 次

ExtJs4关于JsonStore读取数据的问题
在调用的地方我是以下这么写的
tree.js

  var docListSearchStore = ed.common.getStore({
        fields : [{
              name : 'docUnitId',
              mapping : 'docUnitId'
            }, {
              name : 'docUnitName',
              mapping : 'docUnitName'
            }],
        url : 'docListPathSearchController',
        root : 'docList'
      });

调用的common.js中的以下代码这样写的

ed.common.getStore = function(opts) {
  var store = new Ext.data.JsonStore({
        autoDestroy : true,
        url : 'action/' + opts.url,
        method : 'POST',
        baseParams : opts.baseParams,
        timeout : 900000,
        root : opts.root,
        fields : opts.fields,
        totalProperty : opts.totalProperty,
        idProperty : opts.idProperty,
        listeners : {
          'exception' : {
            fn : function(dataProxy, type, action, options, response, arg) {
              if (type != 'remote') {
                var responseObj = Ext.JSON.decode(response.responseText);
                  Ext.Msg.alert(ed.message.MES_TIT_ERROR, responseObj.message);
              } else {
                Ext.Msg.alert(ed.message.MES_TIT_ERROR, ed.resources.NETWORK_ERROR);
              }
            }
          }
        }
      });
  return store;
};

可是监听的时候发现根本就没有走后台,不知道问题出在什么地方,希望高手能指点一下
extjs javascript action

------解决方案--------------------