PDA

View Full Version : combo getValue



sofway
9 Aug 2010, 8:31 AM
Hi,
i have a combo and i cant get the value selected, It gets the initial value and not the selected



xtype: 'combo',
id: 'mycombo',
mode: 'local',
forceSelection: true,
allowBlank: false,
editable: false,
value: 'buscar_todo',
triggerAction: 'all',
store: new Ext.data.ArrayStore({
fields: ['campo_busqueda', 'text'],
data: [
['buscar_todo','Buscar todo'],
['txt1','Txt2'],
['txt2','Txt2']
]
})
valueField: 'campo_busqueda',
displayField: 'text',
hideLabel: true,
width:100


Ext.getCmp('mycombo').getValue() returns the initial value

I have readed about a bug but i cant find a solution.
Thanks

drogers
9 Aug 2010, 12:21 PM
I'm not seeing any problem with it (ExtJS 3.2.2 and 3.1.0). I pasted the following into Firebug in Firefox (minor edits from above) and clicking on the Get Value button after selecting something shows the correct selection:


Ext.onReady(function() {

new Ext.Viewport({
layout: 'form',
items: [
{
xtype: 'combo',
id: 'mycombo',
mode: 'local',
forceSelection: true,
allowBlank: false,
editable: false,
value: 'buscar_todo',
triggerAction: 'all',
store: new Ext.data.ArrayStore({
fields: ['campo_busqueda', 'text'],
data: [
['buscar_todo','Buscar todo'],
['txt1','Txt1'],
['txt2','Txt2']
]
}),
valueField: 'campo_busqueda',
displayField: 'text',
hideLabel: true,
width:100
}, {
xtype: 'button',
text: 'Get Value',
handler: function() {
Ext.Msg.alert('Value', 'Value: ' + Ext.getCmp('mycombo').getValue());
}
}]
});


});