PDA

View Full Version : How to set a item on a select



Flipfine
3 Feb 2012, 5:19 AM
Hey,

I hava a selectfield with options come from a store which i set.
Now if I click on a button I would like to set (not in the config property)
the value of the select. Thats mean you can see the selected value in the
selectfield and if I click the selectfield, the right item is selected.

var selectColor = new Ext.form.Select({
id: 'selectcolor',
name: 'selectcolor',
label: 'Color',
options: [
{text: 'Blue', value: '1'},
{text: 'Red', value: '2'},
{text: 'Yellow', value: '3'},
]
});

In that example I set the options. And how I can set for example
the item yellow ?

Thanks for your help

mitchellsimoens
3 Feb 2012, 6:44 AM
selectColor.setValue('3');

Flipfine
5 Feb 2012, 11:50 PM
Thx it works great