PDA

View Full Version : how to get the value of the selected item in a select ?



Severance
3 Dec 2010, 7:51 AM
hello,

I have a select linked to a store :

var selectPartenaire = new Ext.form.Select({
id: 'selectPartenaire',
name: 'selectPartenaire',
label: 'Partenaire',
displayField: 'de3036',
valueField: 'id_org',
store : storePartenaire
});


then I fullfill the store :

storePartenaire.add({id_org:"-1",de3036:"-- tous --"});

How to get the value of the selected item ? (here -1)

I tried :
Ext.getCmp('selectPartenaire').selectedItem
selectPartenaire.getValues()

but I get "undefined" !

tomalex0
4 Dec 2010, 12:24 AM
Ext.getCmp('selectPartenaire').getValue()

Severance
5 Dec 2010, 11:20 PM
hello,

console.log(Ext.getCmp('selectPartenaire').getValue());

I get "undefined"...

tomalex0
6 Dec 2010, 1:47 AM
Could you check Store count associated with select.