2014-02-05 87 views
0

我的問題是,當我從下拉列表框如何從組合框顯示網格數據

選擇它,我怎麼可以把數據傳輸到電網這是我到目前爲止已經試過,

var store = new Ext.data.JsonStore({ 
       proxy: new Ext.data.HttpProxy({ 
         url: '/index.php/getAnimals' 
        }), 
        root: 'data', 
        pruneModifiedRecords: true, 
        totalProperty: 'total', 
        baseParams: {limit: 25}, 
        autoLoad: {params: {start: 0}}, 
        fields: ['id','animal_name'], 
        sortInfo: {field:'id', direction:'ASC'} 
      }); 






       var grid = new Ext.grid.EditorGridPanel({ 
       id: 'editorgrid', 
       store: store1, 
       title: 'Animals', 
       cm: cm1, 


       width: 400, 
       anchor: '100%', 
       height: 700, 

       frame: true, 
       loadMask: true, 
       waitMsg: 'Loading...', 
       clicksToEdit: 1, 
       tbar: [ 
       'Animals Unit : ', '-',    

       { 
       xtype: 'combo', 
       name: 'company_combo', 

       anchor: '90%', 
       allowBlank: false, 
       editable: false, 
       forceSelection: true, 
       triggerAction: 'all', 
       mode: 'remote', 
       store: new Ext.data.JsonStore({ 
        url: '/index.php/getAnimalsCombo', 
        root: 'data', 
        totalProperty: 'total', 
        fields: ['id','desc'], 
        params: {start: 0}, 
        baseParams: {limit: 25} 
       }), 
       pageSize: 25, 
       displayField: 'desc', 
       valueField: 'id', 
       minListWidth: 150, 
       valueNotFoundText: '', 
       width: 150, 
       minChars: 1 

       }, 

       '-', 

       ],     
      bbar: pager1 
      }); 
+1

連擊,你可以提供一個小提琴?我看不到任何聽衆或類似的組合,你需要聽「change」來處理事件 – lascort

+0

@lascort這是我的問題,我沒有聽衆。 – sack

回答

1

應設置爲組合的聽衆......像這樣

{ 
       xtype: 'combo', 
       name: 'company_combo', 
       listeners:{ 
        "select":function(theCombo, selectedRecord){ 
         var theGrid = theCombo.up("grid"); 
         theGrid.reconfigure(newStore, newColModel); 
        } 
       }, 
       anchor: '90%', 
       allowBlank: false, 
       editable: false, 
       forceSelection: true, 
       triggerAction: 'all', 
       mode: 'remote', 
       store: new Ext.data.JsonStore({ 
        url: '/index.php/getAnimalsCombo', 
        root: 'data', 
        totalProperty: 'total', 
        fields: ['id','desc'], 
        params: {start: 0}, 
        baseParams: {limit: 25} 
       }), 
       pageSize: 25, 
       displayField: 'desc', 
       valueField: 'id', 
       minListWidth: 150, 
       valueNotFoundText: '', 
       width: 150, 
       minChars: 1 

       }, 

你可能要檢查的ExtJS的文檔,這裏是到文檔的鏈接在網格上

http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.grid.Panel

你也應該看看在那裏

+1

請驗證theCombo.up(「網格」)是否正確獲取網格組件,以防萬一 – lascort

相關問題