当前位置: 代码迷 >> Web前端 >> Ext combo 上拉框级联
  详细解决方案

Ext combo 上拉框级联

热度:708   发布时间:2012-10-09 10:21:45.0
Ext combo 下拉框级联
 /********省份start*****************/
    var storeProvince = new Ext.data.ArrayStore({
        fields : [
            'name', 'value'
        ],
        url:'queryProvince'
    });
    storeProvince.load();
    acceptManager_province = new Ext.form.ComboBox({
        renderTo :'province',
        store : storeProvince,          //为省份填充数据
        valueField : 'value',
        displayField : 'name',
        fieldLabel : '省份',
        typeAhead : true,
        mode : 'local',
        forceSelection : true,
        triggerAction : 'all',
        emptyText : '',
        selectOnFocus : true,
        width:100,
        tpl: '<tpl for="."><div ext:qtip="{name}" class="x-combo-list-item">{name}</div></tpl>',
        listeners: {
            'select': function(acceptManager_combo, record, index)
            {
                /*获取选中省份ID*/
                var proId = record.get('value');
                var dataSource = new Ext.data.HttpProxy({
                    method: 'POST',
                    url: 'queryCityPro'
                });
                acceptManager_storeCity.baseParams = {m_proId: proId};
                acceptManager_storeCity.proxy = dataSource;
                acceptManager_storeCity.load();
                acceptManager_city.clearValue();
                acceptManager_city.setValue("");
            }}
    });
    /********省份end*****************/
    //var acceptManager_data = [['全选','1'],['西安','2'],['深圳','3'],['北京','4'],['上海','5']];
    /********城市start*****************/
    acceptManager_storeCity = new Ext.data.SimpleStore({
        fields: [
            "name","value"
        ],
        //proxy: new Ext.data.MemoryProxy(acceptManager_data)
        url:'queryCity'
    });
    acceptManager_storeCity.load();

    acceptManager_city = new Ext.form.MultiComboSearch({
        renderTo :'city',
        store:acceptManager_storeCity,
        valueField :"value",
        displayField: "name",
        labelSeparator:':',
        displaySeparator:',', //多选显示分隔字符
        valueSeparator:',',//多选提交到后台的值分隔符
        mode: 'local',
        value:'',
        forceSelection: true,
        hiddenName:'test',
        editable: false,
        triggerAction: 'all',
        emptyText:'',
        fieldLabel: '城市',
        width:100
    });
    /********省份end*****************/