ExtJs4.0 下拉框联动

Combox.js代码   收藏代码
  1. /**  
  2. * @class Ext.app.AdSiteGrid  
  3. * @extends Ext.grid.GridPanel  
  4. * 内容项Add  
  5. */  
  6. Ext.define('ctiWsSort', {  
  7.     extend: 'Ext.data.Model',  
  8.     fields: [  
  9.             { type: 'string', name: 'Id' },  
  10.             { type: 'string', name: 'Name' }  
  11.            ]  
  12.     });  
  13.     
  14.             wsStore = Ext.create('Ext.data.Store', {  
  15.                 model: 'ctiWsSort',  
  16.                 proxy:  
  17.                  {  
  18.                      type: 'ajax',  
  19.                      url: 'Data/WebServiceComboxData.json',  
  20.                      reader: { type: 'json', root: 'data' },  
  21.                      fields: ['Id''Name']  
  22.                  },  
  23.                 listeners:  
  24.                     {  
  25.                         'load': function (me, record, successful) {  
  26.                             if (successful) {  
  27.                                 var combSort = Ext.getCmp('ctcEditTableName');  
  28.                                 combSort.setValue(combSort.getValue());  
  29.                             }  
  30.                         }  
  31.                     },  
  32.                 autoLoad: true  
  33.             });  
  34.                     {  
  35.                         xtype: 'combo',  
  36.                         fieldLabel: 'Web Service接口',  
  37.                         allowBlank: false,  
  38.                         blankText: "此项不能为空",  
  39.                         id: 'ctiEidtWebServie',  
  40.                         name: 'wsName',  
  41.                         typeAhead: true,  
  42.                         displayField: "text",  
  43.                         valueField: "value",  
  44.                         queryMode: 'local',  
  45.                         store: new Ext.data.SimpleStore({  
  46.                             fields: ["text""value"],  
  47.                             data: [["热点新闻接口""1"], ["产品库存接口""2"], ["新闻维护接口""3"]]  
  48.                         }),  
  49.                         listeners: {  
  50.                             "select": function (combo, record, index) {  
  51.                                 alert(combo.value);  
  52.                                 wsStore.proxy.url = 'Data/WebServiceComboxData2.json';  
  53.                                 wsStore.load();  
  54.                             }  
  55.                         }  
  56.                     },  
  57.                     {  
  58.                         xtype: 'combo',  
  59.                         fieldLabel: "数据库表名",  
  60.                         blankText: "此项不能为空",  
  61.                         allowBlank: false,  
  62.                         id: "ctcEditTableName",  
  63.                         name: "TableName",  
  64.                         displayField: "Name",  
  65.                         valueField: "Id",  
  66.                         queryMode: 'local',  
  67.                         typeAhead: true,  
  68.                         store: wsStore  
  69.                     }  
  70.       

你可能感兴趣的:(Ajax,String,webservice,function,ExtJs,autoload)