PDA

View Full Version : How to link two combo boxes which are inside Editor grid ?



srinivasp
17 Dec 2009, 2:37 AM
Hi
I am using Editor grid panel.In that i have two combo box cloumns . First combo box is loaded with data when grid is created.Based on selction the second combo box should load with data.Please tell me how to resolve it.

my sample code is here


var store = new Ext.data.JsonStore({
fields: [
{name: 'name'},
{name: 'subjectc'}
]
});
var nameStore = new Ext.data.JsonStore({
fields: ['name'],
data : nameList
});
var ownerCombo = new Ext.form.ComboBox({
store: nameStore ,
displayField:'name',
typeAhead: true,
mode: 'local',
forceSelection: true,
triggerAction: 'all',
emptyText:'Select Name...',
selectOnFocus:true,
listeners:{
'select': function(combo, record){
// Here I need to update second combo box
}
}
});

var subStore = new Ext.data.JsonStore({
fields: ['name'],
data : subList
});
var subCombo = new Ext.form.ComboBox({
store: nameStore ,
displayField:'name',
typeAhead: true,
mode: 'local',
forceSelection: true,
triggerAction: 'all',
emptyText:'Select Name...',
selectOnFocus:true,
listeners:{
'select': function(combo, record){

}
}
});
var grid= new Ext.grid.EditorGridPanel({
store: store,
renderTo:'dataGrid',
title : 'DataCapture',
loadMask:true,
trackMouseOver:false,
frame:true,
resizable:true,
layout:'accordion',
plugins:[nameCombo ,subCombo ],
columnLines : true,
loadMask: true,
columns: [
{id:'name',header: 'name', width: 100, sortable: true, dataIndex: 'name',editor: nameCombo},
{id:'sub',header: 'name', width: 100, sortable: true, dataIndex: 'sub',editor: subCombo}]
});