PDA

View Full Version : Select the right value in a combobox



mattn
14 Jun 2007, 3:54 AM
Hello,

I am trying to get a form filled with data everything works except a combobox who displays the Id instead of the selected value.

The data is loaded with a php generated json file



var oplReader = new Ext.data.JsonReader({
id: 'oplId'
}, [ 'oplId', 'oplNaam']);

var oplDS = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: 'json/getOpleidingen.php'
}),
reader: oplReader,
remoteSort: false
});


The rest of the form comes out of a php generated xml file
So the value out of the xml file should be linked with the combobox.
When I open the form al the data is correct but instead of the text it shows the id in the combobox.
When I click on the combobox the different values are show and the right value is highlited.

How does it comes that the text isn't displayed when the page is loaded?

this is the code of the combobox



fs.add(
new Ext.form.ComboBox({
fieldLabel: 'Opleiding',
hiddenName:'opleiding',
store: oplDS,
valueField:'oplId',
displayField:'oplNaam',
typeAhead: true,
triggerAction: 'all',
emptyText:'Selecteer opleiding',
selectOnFocus:true,
width:300
})
);


In the rest of the form I use Other comboboxes who work perfecly



new Ext.form.ComboBox({
fieldLabel: 'Interesse voor \'t vak',
hiddenName:'interesse',
store: new Ext.data.SimpleStore({
fields: ['abbr', 'staat'],
data : Ext.exampledata.goedZeergoed
}),
valueField:'abbr',
displayField:'staat',
typeAhead: true,
mode: 'local',
triggerAction: 'all',
emptyText:'Selecteer niveau',
selectOnFocus:true,
width:120
}),


Do I have to load the data in the combobox on a page load?
And how do I do that??

thx for the help