2014-02-05 32 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

相关问题