Ext 下拉框联动第一次显示不正常的问题

做下拉框联动,异步加载数据,第一次显示时数据不准确,不要在combo_2的下拉框直接绑定store,在combo_1的改变事件里调用下面的方法

function GetAllCustomerBrand(customerID) {
    var storeCustomerBrand = Ext.StoreManager.lookup("customerBrandStoreCombo");
    if (!storeCustomerBrand) {//第一次加载
        storeCustomerBrand = Ext.create("Ext.data.Store", {
            storeId: "customerBrandStoreCombo",
            fields: ["BrandID", "BrandName", "ApplyUserID"],
            proxy: {
                url: "url",
                type: "ajax",
                extraParams: { "customerID": customerID
            },
            listeners: {
                "load": function (store, records, opts) {
                    store.add({ "BrandName": "新建品牌...", "BrandID": 1, "ApplyUserID": null });
                }
            }
        });
        Ext.getCmp("combo_2").bindStore(storeCustomerBrand);//首次加载 combo_2绑定此store
    }
    else {
        storeCustomerBrand.load({ params: { "customerID": customerID } });
    }
}
上一篇:序列化form表单内容为json对象


下一篇:centos 源码安装python