PDA

View Full Version : combobox selection on form load



gero013
17 Jan 2011, 12:24 AM
Hello, I'm newbie to JS and ext - so I apologize any stupid error.

I have a master/detail grid and loading of grid and form works so far. Now I change a status field to combobox (with a local store) in the form and manual selection works fine. When I select a row in the grid, wich triggers a form load, the status value will be shown as numeric, so the selection of the combobox did not work.

What am I missing? My code is this:
var dsWorkState = new Ext.data.ArrayStore({
fields: ['status', 'label'],
data : [
[ '0', 'first' ],
[ '1', 'status-2' ],
[ '2', 'status-3' ],
[ '3', 'status-4' ],
[ '4', 'last' ]
]
});


part of the form items:

item: [{
...
}, new Ext.form.ComboBox({
store: dsWorkState,
fieldLabel: 'Status',
hiddenName: 'status',
displayField: 'label',
mode: 'local',
emptyText: 'Select a status',
triggerAction: 'all',
selectOnFocus: true,
forceSelection: true
}), ...
kind regards

Gero

Condor
17 Jan 2011, 12:33 AM
Don't you want valueField:'status'?

gero013
17 Jan 2011, 12:46 AM
Thank you very much for your time and support!
The samples, I found, did not use that field, so I missed the importance of it.

kind regards

Gero