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

Extjs4级联combobox的问题,大家帮忙看看了
省市地区三级联动combobox,第一次操作没有问题,第二次选择省份信息后,加载市区信息就一直显示“加载中...”的遮罩效果,无法加载。
附代码,求大家帮忙看下
combobox.js
JScript code

Ext.onReady(function() {
    
    //定义ComboBox数据源模型
    Ext.define('State', { 
        extend: 'Ext.data.Model', 
        fields: [ 
            {type: 'int', name: 'id'}, 
            {type: 'string', name: 'cname'} 
        ] 
    });
    
    //加载省份数据源 
    var store1 = Ext.create('Ext.data.Store', { 
        model: 'State', 
        proxy: { 
            type: 'ajax', 
            url: 'provinces_regions.jsp?act=sheng&n='+new Date().getTime()+'' 
        }, 
        autoLoad: true, 
        remoteSort:true 
    });
    
    //加载市区数据源 
    var store2 = Ext.create('Ext.data.Store', { 
        model: 'State', 
        proxy: { 
            type: 'ajax', 
            url: 'provinces_regions.jsp?act=shi&n='+new Date().getTime()+''
        }, 
        autoLoad: false, 
        remoteSort:true 
    });
    
    //加载地区数据源 
    var store3 = Ext.create('Ext.data.Store', { 
        model: 'State', 
        proxy: { 
            type: 'ajax', 
            url: 'provinces_regions.jsp?act=qu&n='+new Date().getTime()+''
        }, 
        autoLoad: false, 
        remoteSort:true 
    })

    var combo1 = Ext.create('Ext.form.ComboBox', {
        fieldLabel        :    '省份',
        //store            :    states,
        name            :    "sheng",
        id                :    "shengid",
        store            :    store1,
        queryMode        :    'local',
        displayField    :    'cname',
        valueField        :    'id',
        triggerAction    :    'all',
        selectOnFocus    :    true,
        forceSelection    :    true,
        allowBlank        :    true,
        editable        :    true,
        emptyText        :    "请选择省份1",
        blankText        :    "请选择省份",
        listeners        :    {
            'select'    :    function(combo, record, index) {
                try{ 
                    combo2.clearValue();
                    combo3.clearValue();
                    combo2.store.load({params:{param:this.value}}); 
                 } catch(ex){ 
                     Ext.MessageBox.alert("错误","数据加载失败。"); 
                 } 
            }
        }
    });
    
    var combo2 = Ext.create('Ext.form.ComboBox', {
        fieldLabel        :    '市区',
        name            :    "shi",
        id                :    "shiid",
        store            :    store2,
        queryMode        :    'local',
        displayField    :    'cname',
        valueField        :    'id',
        triggerAction    :    'all',
        selectOnFocus    :    true,
        forceSelection    :    true,
        allowBlank        :    true,
        editable        :    true,
        emptyText        :    "请选择市区1",
        blankText        :    "请选择市区",
        listeners        :    {
            'select'    :    function(combo, record, index) {
                try{ 
                    combo3.clearValue();
                    combo3.store.load({params:{param:this.value}}); 
                 } catch(ex){ 
                     Ext.MessageBox.alert("错误","数据加载失败。"); 
                 } 
            }
        }
    });
    
    var combo3 = Ext.create('Ext.form.ComboBox', {
        fieldLabel        :    '地区',
        name            :    "qu",
        id                :    "quid",
        store            :    store3,
        queryMode        :    'local',
        displayField    :    'cname',
        valueField        :    'id',
        triggerAction    :    'all',
        selectOnFocus    :    true,
        forceSelection    :    true,
        allowBlank        :    true,
        editable