-
17 Dec 2010 7:07 AM #1
autoSelect on Combo?
autoSelect on Combo?
Hi all, i'm having a couple of problems using the combo for a simpleStore? Combo populates fine but never autoSelects the first element? If i enforce selection though setValue etc then this is fine but if i try to access the value using getValue() it returns the value of the 'displayField' e.g in this case 'first'/'second' etc. If i then select an item from the list and then access the value again using getValue() then it returns 1/2/3 as would be expected? Its almost as if the 'values' are not set until the combo receives a 'select' event?
Code:var store = new Ext.data.SimpleStore( { id: 'testStore', fields: ['id','description'], data : [['1','first'],['2','second'],['3','third']] }); var combo = new Ext.form.ComboBox( { store: store, displayField: 'description', valueField: 'id', mode: 'local' });
-
17 Dec 2010 7:32 AM #2
ok, i understand now that the autoSelect has nothing to do with selecting the first result or item in the results array. I then thought i'd found another user with the same problem at
http://www.sencha.com/forum/showthre...e+displayValue
Similar issue but the solution didn't work for me, i've tried using the ArrayStore in place of the SimpleStore but still not getting a fix
-
17 Dec 2010 8:06 AM #3
Maybe this helps.
PHP Code:forceSelection : Boolean
-
17 Dec 2010 8:20 AM #4
If you just want your combobox to show the first item, you can just manually hard code it like this:
PHP Code:var combo = new Ext.form.ComboBox(
{
store: store,
displayField: 'description',
valueField: 'id',
mode: 'local' ,
value: '1'
});
Last edited by Danek1313; 17 Dec 2010 at 8:22 AM. Reason: Not sure how to highlight within code block
Similar Threads
-
[CLOSED] combo autoSelect doesn't work with ArrayStore
By PaloAltoNetworks in forum Ext 3.x: BugsReplies: 2Last Post: 14 Dec 2010, 2:16 AM -
Why combobox can't do autoselect?
By freezq in forum Ext 3.x: Help & DiscussionReplies: 8Last Post: 11 Aug 2010, 3:11 PM -
Autoselect on combobox
By Shenryu in forum Ext 3.x: Help & DiscussionReplies: 0Last Post: 19 Oct 2009, 2:29 AM -
Help with combobox autoselect
By gvargas in forum Ext 2.x: Help & DiscussionReplies: 1Last Post: 2 Jun 2009, 8:11 AM -
How to autoselect the first element in a combobox?
By ryanslade in forum Ext 1.x: Help & DiscussionReplies: 2Last Post: 9 Aug 2007, 4:39 PM


Reply With Quote