Gelmiş geçmiş en büyük porno sitemiz olan 2pe de her zaman en kaliteli pornoları sunmayı hedefledik. Diğer video sitemiz olan vuam da ise hd porno ağırlıklı çalışmalara başladık.

  1. #1
    Sencha User
    Join Date
    May 2009
    Posts
    10
    Vote Rating
    0
    gaboo is on a distinguished road

      0  

    Default ComboBox default selection

    ComboBox default selection


    Hello,

    I would like to set the default selection to ComboBox, but unfortunately I
    cannot make it. I call the setValue(rec) (or setSelection(java.util.List<D> selection)) method, but in this case all the
    other items of store disappear and only the selected item can be seen in the
    list.
    As i remember it worked with the version of 2.0.1, but does not work with the version of
    2.1

    Test code:

    Code:
    public class ComboTest implements EntryPoint {
    
        public void onModuleLoad() {
            FormPanel p = new FormPanel();
            
            ModelData m1 = new BaseModelData();
            m1.set("name", "first");
            ModelData m2 = new BaseModelData();
            m2.set("name", "second");
            
            ComboBox<ModelData> cb = new ComboBox<ModelData>();
            cb.setFieldLabel("Combobox");
            cb.setDisplayField("name");
            cb.setStore(new ListStore<ModelData>());
            cb.getStore().add(Arrays.asList(m1, m2));
            p.add(cb);
    
            cb.setValue(m2);
            
            RootPanel.get().add(p);
        }
    }
    Best regards,

    Gaboo

  2. #2
    Sencha User
    Join Date
    May 2009
    Posts
    10
    Vote Rating
    0
    gaboo is on a distinguished road

      0  

    Default Solution?

    Solution?


    I didnt find any solution so i use gwt's ListBox instead of gxt's ComboBox:

    Code:
    public static AdapterField _createLB(String label, String name, List<BaseModelData> datas, int defSelection) {
            ListBox lb = new ListBox();
            lb.setName(name);
            int x = 0;
            for (BaseModelData i : datas) {
                int val = ((Integer)i.get("id")).intValue();
                lb.addItem((String)i.get("name"), Integer.toString(val));
                if (val == defSelection)
                    lb.setSelectedIndex(x);
                x++;
            }
            
            AdapterField f = new AdapterField(lb);
            f.setFieldLabel(label);
            return f;
        }
        
        public static void _setLBSelect(final int id, final ListBox lb) {
            int c = lb.getItemCount();
            for (int i = 0; i < c; i++) {
                int val = Integer.parseInt(lb.getValue(i));
                if (val == id) {
                    lb.setSelectedIndex(i);
                    break;
                }
            }
        }

  3. #3
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    Code:
    cb.setTriggerAction(TriggerAcion.ALL);

  4. #4
    Sencha User
    Join Date
    May 2009
    Posts
    10
    Vote Rating
    0
    gaboo is on a distinguished road

      0  

    Default


    Thanks Sven!

  5. #5
    Sencha User
    Join Date
    Sep 2008
    Posts
    9
    Vote Rating
    0
    me2 is on a distinguished road

      0  

    Default


    In version 2.1 the ComboBox was changed to have lazy render by default - we've found this caused problems with setting default values, so had to call setLazyRender(false) on combo boxes that need a default value.

  6. #6
    Ext User
    Join Date
    Feb 2010
    Posts
    1
    Vote Rating
    0
    Abraham1 is on a distinguished road

      0  

    Default


    Interesting post dude….Forums are always helpful in one way or the other, anyways. Thanks for giving out information. It’s really nice and mean full.

  7. #7
    Sencha User WesleyMoy's Avatar
    Join Date
    Oct 2009
    Location
    Redwood City, California
    Posts
    402
    Vote Rating
    2
    WesleyMoy is on a distinguished road

      0  

    Default


    Quote Originally Posted by sven View Post
    Code:
    cb.setTriggerAction(TriggerAcion.ALL);
    Expanding a bit on this answer: when you set that default value, the combo box contains the text "second". When you expand the combo box, you are only showing the results that start with the text "second". By setting TriggerAction to ALL, you are choosing not to have the combo box filter at all.

    You can try this with the two values "apple" and "applepie" for comparison.