Results 1 to 3 of 3

Thread: Default value in combo box

  1. #1
    Ext User
    Join Date
    Nov 2009
    Posts
    81
    Vote Rating
    0
      0  

    Default Default value in combo box

    Hi all,

    I'm trying to put a default value in my combo box, but it's not working.
    This is my sample code :

    Code:
    SimpleComboBox<String> scb = new SimpleComboBox<String>();
    scb.add("Value1");
    scb.add("Value2");
    scb.add("Value3"); 
    scb.addSelectionChangedListener(new SelectionChangedListener<SimpleComboValue<String>>() 
    {
        @Override
        public void selectionChanged(SelectionChangedEvent<SimpleComboValue<String>> se)
        {
            MessageBox.alert("Selected value", "Selected value : " + se.getSelectedItem().getValue(), null);
        }
    });
    scb.setValueField("Value1");
    panel.add(scb);
    How to correct it ?
    Thanks in advance for your answers

  2. #2
    Sencha Premium Member
    Join Date
    Sep 2007
    Posts
    13,976
    Vote Rating
    131
      0  

    Default

    You are not setting any value. You are setting the name of a value field. You need to use setSimpleValue

  3. #3
    Ext User
    Join Date
    Nov 2009
    Posts
    81
    Vote Rating
    0
      0  

    Default

    Thanks for your answer, i'll try it

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •