PDA

View Full Version : Populating a Combobox Conditionally in a Grid



paulharv
16 Jul 2010, 10:07 AM
Hi,

I have a grid.
One of the columns is defined with a ComboBox editor like this...



var cm = new Ext.grid.ColumnModel({
columns: [
// ... some columns ...
{
// various config options...
editor: new Ext.form.ComboBox({
typeAhead: true,
emptyText: 'Type a category',
store: new Ext.data.JsonStore({
url: 'agencies/categories',
fields: [
{name:'categoryId', type:'int'},
'categoryText'
]
}),
listeners: {
'expand': function(combo) {
// I NEED TO RELOAD THE STORE FOR THE COMBO
// SENDING PARAMS THAT ARE SPECIFIC TO THE
// TO THE PARTICULAR ROW/RECORD I'M WORKING WITH
// SO I CAN LOAD THE COMBO WITH JUST THER RIGHT OPTIONS
// FOR THE RECORD I'M WORKING WITH
// HOW TO DO IT?!
}
}
})
},
// ... more columns ...
]
})


My problem is explained in the comment in the code above. Maybe my approach is off - but I need to load the Combo box with options specific to that row. When the user expands, I want to go to the server and get the options.
Trouble is, since only the combo is passed into the handler, I don't know how to get a reference to the record/row I'm working with in order to get the params I need.

Is this the event I want to handle or is there something better? Or is there some better approach altogether?

Thanks,

Paul