-
9 Apr 2011 11:33 PM #1
How to highlight item from combobox's listview
How to highlight item from combobox's listview
I have combobox which uses loader to query values from server. When data is loaded, I wan't to highlight/select the first item from combobox's listview and not the one which matches user's query.
So if user types 'car' and server returns 'bike' and 'car', it now highlights 'car' (and scrolls listview if item isn't visible). How to select 'bike' item so listview wouldn't scroll?
I tried to add listener to loader's 'load' event but no success.
Code:loader.addListener(Loader.Load, new Listener<LoadEvent>() { public void handleEvent(LoadEvent be) { combo.select(0); } });
-
12 Apr 2011 4:57 AM #2
Here's one solution if someone has the same problem.
I override combobox's selectByValue method, and now it always selects first item on list. If someone knows better solution, please tell me.
Code:final ComboBox<Model> combo = new ComboBox<Model>() { @Override protected boolean selectByValue(String value) { if(getStore().getCount() > 0) { select(0); return true; } else return false; } };
Similar Threads
-
Highlight of Selected Item when animating using setCard method
By ClintPick in forum Sencha Touch 1.x: DiscussionReplies: 2Last Post: 10 Aug 2010, 1:18 AM -
[SOLVED] ListView select first item
By walldorff in forum Ext 3.x: Help & DiscussionReplies: 2Last Post: 5 Dec 2009, 4:02 AM -
How to add an item to a Listview?
By poyo in forum Ext 3.x: Help & DiscussionReplies: 4Last Post: 4 Sep 2009, 11:05 PM -
how can I add checkbox in ListView's each item?
By zzsnake in forum Ext 3.x: Help & DiscussionReplies: 0Last Post: 6 Aug 2009, 6:19 AM


Reply With Quote