PDA

View Full Version : Why the combobox doesn't work?



marcomarco
30 Aug 2011, 4:01 AM
Hi!!!

I have working around a couple of days around the form control combobox, and my conclusion
about it control is very very bad.

.- Is a epic history to find good documentation about.
.- To get the selected value (not the text) is very difficult
.- The form do not submit the selected value
.- When I have selected one option, I can't select another one.

I need urgent help to fix this problem. I'm a consultant and my time is wasting
due to this errors.

Thanks in advance..

Platform : firefox 6.
Extjs: ext-4.0.4

marcomarco
30 Aug 2011, 6:26 AM
I have seen that the behavior of combobox depends in the Store.

When I have a Store with proxy rest, the combobox have a bad behavior


proxy: {
type: 'rest',
url: 'domain/getmarcas',
appendId: true,
reader : {
type : 'json',
root : 'data',
totalProperty : 'count'
},
.....
.....
}

But when I have a simple local Store combobox works.


store: new Ext.data.SimpleStore({
fields: ['value', 'name'],
data: [['1', 'A'], ['2', 'B'], ['3', 'C']]
}),


Some help?

mitchellsimoens
30 Aug 2011, 7:26 AM
Documentation shows how to create a ComboBox as do the examples.
If you need to get the displayField value instead of valueField then you have to get it from the Store, this is only a couple steps.
If the Form is submitting the id and not the text, then you have it set up incorrectly. Whatever field valueField is set to will be submitted so if you have the valueField set to id then it will submit the id. If you have it set to text, it will submit the text.
If you want to be able to select multiple items, set multiSelect to true on the ComboBox, this is in the documentation.