1. #1
    Sencha User
    Join Date
    Jul 2010
    Posts
    7
    Vote Rating
    0
    anttihavanko is on a distinguished road

      0  

    Default 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);
               }
           });

  2. #2
    Sencha User
    Join Date
    Jul 2010
    Posts
    7
    Vote Rating
    0
    anttihavanko is on a distinguished road

      0  

    Default


    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

  1. Highlight of Selected Item when animating using setCard method
    By ClintPick in forum Sencha Touch 1.x: Discussion
    Replies: 2
    Last Post: 10 Aug 2010, 1:18 AM
  2. [SOLVED] ListView select first item
    By walldorff in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 5 Dec 2009, 4:02 AM
  3. How to add an item to a Listview?
    By poyo in forum Ext 3.x: Help & Discussion
    Replies: 4
    Last Post: 4 Sep 2009, 11:05 PM
  4. how can I add checkbox in ListView's each item?
    By zzsnake in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 6 Aug 2009, 6:19 AM
Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi