PDA

View Full Version : feeding combobox with data



sancho1980
27 Oct 2010, 1:27 AM
hi

this exercise is driving me mad:

suppose i have an Ext.grid.ColumnModel with one column being defined as follows:


{
header: 'Party',
dataIndex: 'IDparty',
width: 120,
editor: new Ext.form.ComboBox(
{
store: PartiesListingDataStore, // or whatever you've called it
displayField:'Name',
typeAhead: true,
valueField: 'IDparty',
mode: 'remote',
triggerAction: 'all',
selectOnFocus:true
),
hidden: false
}The data for the grid comes from ONE store (PresidentsDataStore) and the data for the combo box comes from ANOTER store (PartiesListingDataStore):



PartiesListingDataStore = new Ext.data.Store(
{
id: 'PartiesListingDataStore',
proxy: new Ext.data.HttpProxy({
url: 'DATABASE.php', // File to connect to
method: 'POST'
}),
baseParams: {task: "list_parties"}, // this parameter asks for listing
reader: new Ext.data.JsonReader({ // we tell the datastore where to get his data from
root: 'results',
totalProperty: 'total',
id: 'IDparty'
},[
{
name: 'IDparty',
type: 'int',
mapping: 'IDparty'
},
{
name: 'Name',
type: 'string',
mapping: 'name'
}
]),
sortInfo: {
field: 'IDparty',
direction: "ASC"
}
}
);
So now when the grid is loaded, the column value is immediately initialised to the id (NOT the name) of the party (which is exactly what I want). Alas, the displayed value is also initialised to the id!! Only when I select another party is the displayed value adjusted to the party name (not the ID).

How can I do this?

Thanks

Animal
27 Oct 2010, 2:09 AM
Condor has a special Column UX to handle this. It came up only recently. I'll have a look for it if Condor isn't around...

raj_plays
27 Oct 2010, 2:15 AM
Use combocolumn
http://www.sencha.com/forum/showthread.php?67488-3.x-Ext.grid.ComboColumn-amp-Ext.util.Format.comboRenderer

Animal
27 Oct 2010, 2:22 AM
That's the one!