朱在铸先生 2017-02-06 02:36 采纳率: 100%
浏览 1502
已采纳

extjs4 问题,store.load问题

 businessQueryModule.orgInfoStore = new Ext.data.Store({
    proxy : {
        type : 'ajax',
        url : businessQueryModule.queryUtil + '!queryOrgInfo',
        reader : {
            type : 'json',
            root : "enumerationList"
        }
    },
    fields : [ {
        name : 'enumMeaning'
    }, {
        name : 'enumCode'
    } ]
});
 xtype : "combo",
    readOnly : false,
    editable : false,
    mode : 'local',
    emptyText : '请选择城市',
    valueField : 'enumCode',
    displayField : 'enumMeaning',
    triggerAction : 'all',
    listeners : {
        render : function() {
            Ext.fly(this.el).on('click',function(e,t) {
                    businessQueryModule.orgInfoStore.load({
                            params : {
                                'domainId' : Ext.getCmp(businessQueryModule.idPrefix+ 'domainId').getValue()
                            }
                    });
            });
        },
        'change' : function(obj,newValue, oldValue,eOpts) {
            Ext.getCmp(businessQueryModule.idPrefix + 'equipMentID').clearValue();
            Ext.getCmp(businessQueryModule.idPrefix + 'termID').clearValue();
            Ext.getCmp(businessQueryModule.idPrefix + 'operatorNum').clearValue();
            if(newValue == ""){
                Ext.getCmp(businessQueryModule.idPrefix + 'orgID').clearValue();
            }

        }
    },
    store : businessQueryModule.orgInfoStore,
    margin : '5 0 0 0',
    id : businessQueryModule.idPrefix
            + 'orgID',
    width : 150
}

当点击下拉框后,会先store.load一次,再在监听里面store.load一次。
共load了两次,而且第一次load应为没有传参,后台还会报错。
怎么解决这个问题,我只想在监听里面load就可以了,因为如果params写在外面会取不到对象的值。

  • 写回答

2条回答 默认 最新

  • 朱在铸先生 2017-02-06 07:57
    关注

    将 proxy 写在事件里面就可以了,用store.setProxy()

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?