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.       
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章