PDA

View Full Version : ComboBox in Toolbar Initial Value?



JJD1313
16 Sep 2010, 8:36 AM
Hello,

I am trying to add a ComboBox into a toolbar using its xtype. My code looks as follows:



{
xtype: 'combo',
store: [
['p', 'parallel'],
['s', 'sequence']
]
}


I would like the combobox to automatically populate itself with the first option (parallel), not a blank space. I've tried putting a listener to select it in the toolbar's renderer, the combobox's renderer, and the store's load event. None of these have worked. I figured there would be a simple config option for this, but I can't seem to find one. How can I auto select the first item in the store?

Thanks!

troseberry
16 Sep 2010, 10:27 AM
Have you tried using the combobox methods - select, setValue, or the value config option? Try one of these methods.http://dev.sencha.com/deploy/ext-3.3-beta1-6976/docs/?class=Ext.form.ComboBox

JJD1313
16 Sep 2010, 10:36 AM
I figured it out. When I initially tried using the value: config option, I was setting it to combobox.getStore().data[0] instead of just 'p'. Someone showed me this, I would have never thought to try it just based on the documentation.

Oh, and I had to add triggerAction: 'all' as another config option.

laurentParis
16 Sep 2010, 11:18 AM
{
xtype: 'combo',
store: [ ['p', 'parallel'], ['s', 'sequence'] ],
value: 'p'
}