2012-11-22 54 views
1

獲得價值,這裏是我的代碼:ExtJS的3.4:與其他編輯字段

{header: "Kabupaten", width: 60, sortable: true, dataIndex: 'id_k', 
     renderer: function(value, metaData, record, rowIndex, colIndex, store) { 
      return rend_kab(value); 
     }, 
     editor: new Ext.form.ComboBox({ 
      listeners: { 
       beforequery: function(qe){ 
       qe.combo.store.setBaseParam('id_p', "VALUE FROM THE OTHER FIELD"); 
       }, 
       scope:this 
      }, 
      store : kab, 
      valueField: 'id_k', 
      displayField: 'nm_kb', 
      triggerAction: 'all' 
     }) 
    }, 
    {header: "Provinsi", width: 60, sortable: true, dataIndex: 'id_p', 
     renderer: function(value, metaData, record, rowIndex, colIndex, store) { 
      return rend_prov(value); 
     }, 
     editor: new Ext.form.ComboBox({ 
      store : prov, 
      valueField: 'id_p', 
      displayField: 'nm_p', 
      triggerAction: 'all' 
     }) 
    } 

看到文本「值與其他領域」,我希望它在同一行價值變動從外地「id_p」。 .. 我該怎麼做? 謝謝...

回答

0

你可以去,

editor: new Ext.form.ComboBox({ 
      listeners: { 
       beforequery: function(qe){ 
//If you have checkbox selection model then 
// to get rowIndex need to catch row in which combobox is present. using 
//this.parent.getSelectionModel().getSelected() 
        qe.combo.store.setBaseParam('id_p', gridStore.getAt(rowIndex).get("id_p")); 

       }, 
       scope:this 
      }, 
      store : kab, 
      valueField: 'id_k', 
      displayField: 'nm_kb', 
      triggerAction: 'all' 
     }) 
+0

但是,this.gerSelectionModel()不工作,它說「不」的函數......有 –

+0

然後你不選擇model.Not一個prroblem .. – vajrakumar

0

您可以訪問不同的方式組件/變量:

比方說你有兩個組合框:

​​

1)只使用變量。

SetParam(ComboBoxP.getValue() + ComboBoxKB.getValue()); 

2)使用ID和getComponent(getCmp短,因爲ID必須是唯一的,這是不推薦的方式)

SetParam(Ext.getCmp('CBP').getValue() + Ext.getCmp('CBKB').getValue()); 

3)尋找你的父容器組件。對於這種方法,你需要在你的應用程序中有一個好的結構,並且對上/下選擇器有很好的瞭解。

this.up('form').down('combobox').getValue(); 
+0

但是當我打開其他'id_k'組合,'id_p'關閉... 使其更改爲普通文本... –

+0

當組合框關閉時,您仍可以檢索所選的值。如果您需要另一個值,則可以訪問商店。 – A1rPun