ExtJs4 下拉框联动

 

/**
* @class Ext.app.AdSiteGrid
* @extends Ext.grid.GridPanel
* 内容项Add
*/
Ext.define('ctiWsSort', {
    extend: 'Ext.data.Model',
    fields: [
            { type: 'string', name: 'Id' },
            { type: 'string', name: 'Name' }
           ]
    });
  
            wsStore = Ext.create('Ext.data.Store', {
                model: 'ctiWsSort',
                proxy:
                 {
                     type: 'ajax',
                     url: 'Data/WebServiceComboxData.json',
                     reader: { type: 'json', root: 'data' },
                     fields: ['Id', 'Name']
                 },
                listeners:
                    {
                        'load': function (me, record, successful) {
                            if (successful) {
                                var combSort = Ext.getCmp('ctcEditTableName');
                                combSort.setValue(combSort.getValue());
                            }
                        }
                    },
                autoLoad: true
            });
                    {
                        xtype: 'combo',
                        fieldLabel: 'Web Service接口',
                        allowBlank: false,
                        blankText: "此项不能为空",
                        id: 'ctiEidtWebServie',
                        name: 'wsName',
                        typeAhead: true,
                        displayField: "text",
                        valueField: "value",
                        queryMode: 'local',
                        store: new Ext.data.SimpleStore({
                            fields: ["text", "value"],
                            data: [["热点新闻接口", "1"], ["产品库存接口", "2"], ["新闻维护接口", "3"]]
                        }),
                        listeners: {
                            "select": function (combo, record, index) {
                                alert(combo.value);
                                wsStore.proxy.url = 'Data/WebServiceComboxData2.json';
                                wsStore.load();
                            }
                        }
                    },
                    {
                        xtype: 'combo',
                        fieldLabel: "数据库表名",
                        blankText: "此项不能为空",
                        allowBlank: false,
                        id: "ctcEditTableName",
                        name: "TableName",
                        displayField: "Name",
                        valueField: "Id",
                        queryMode: 'local',
                        typeAhead: true,
                        store: wsStore
                    }
    

你可能感兴趣的:(extjs4,下拉框联动)