Results 1 to 8 of 8

Thread: Cannot change combobox selection when editable == false

  1. #1

    Default Cannot change combobox selection when editable == false

    I have a combobox that looks alot like this:

    Code:
    var fldCombo =
      {
      xtype:        'combo',
      id:           'combobox_id',
      hiddenName:   'combobox_value',
      valueField:   'id',
      autoWidth:    true,
      mode:         'local',
      editable:     false,
      typeAhead:    false,
      fieldLabel:   'My Combobox Field',
      store:        json_store,
      displayField: 'name'
      };
    Since it isn't editable, once a value has been selected, you can never change it! Even though typeAhead is set to false, the drop down only shows the selected value when the combo box is clicked.

    I have created a work around by setting a listener to clear the box when it's clicked, but it's a really ugly thing to have to do.

    Am I missing something?

  2. #2
    Sencha User jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    DC Area =)
    Posts
    16,364

    Default

    are you using the cookie thing - just curious.

  3. #3

    Default

    not sure which cookie thing you're referring to.

    I believe the problem is that when you have editable set to false and typeAhead set to true, when you click into an already selected combo (you can recreate this by creating a combo and presetting it's value to an existing value in your store), the typeAhead check sees that you've got a matching string, which, because it's equal to a value in the select list, selects that value. None of the other values are displayed, because they don't pass the typeAhead test. Of course, the only value that will pass the test will be the selected value, plus any values where the selected value occurs as the beginning of the string.

    Consider the list of values "foo", "bar", "ba" and "baz"

    If I set
    Code:
    value: "foo"
    in my config, then of course, when the combobox is created, it will contain foo as it's value, and the drop down will only display foo, as "bar", "ba" and "baz" don't match the typeAhead.

    If I preselect "ba", of course, I expect to see "bar" and "baz" as well when clicking on the combo.

    Unfortunately, it seems this behavior occurs no matter what typeAhead is set to -- to work around, I have set editable to true, so that you can delete the current selected value by hand in order to get the drop down to display all values. Of course, this means the user can type whatever they want into my combo, which is not a desired function.

  4. #4

  5. #5

    Default

    No, I'm not using the CookieProvider.

    What's the connection, out of curiousity?

  6. #6
    Sencha User jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    DC Area =)
    Posts
    16,364

    Default

    just asking. i've read about some strange stuff going on w/ that cookie gizmo.

  7. #7
    Ext User halkon_polako's Avatar
    Join Date
    Nov 2007
    Location
    Barcelona
    Posts
    193

    Default

    Set the combobox property triggerAction to 'all'.
    Code:
    ...
       triggerAction:'all',
    ...

  8. #8

    Default

    That does the trick!

    Thanks

Posting Permissions

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