1. #1
    Sencha User
    Join Date
    May 2010
    Location
    Belgium
    Posts
    206
    Answers
    3
    Vote Rating
    1
    marxan is on a distinguished road

      0  

    Default Answered: Unset a value in multiselect combo

    Answered: Unset a value in multiselect combo


    Hello,

    Is there a method to unselect a specific value of a multiselect combo.

    In other words, I have a default value selected and when the user select another value, the default value should be unselected.

    Thanks.

  2. What does getValue() returns an array? Then pop the default value out of that array and set the array again with setValue()

    Code:
    var values = combo.getValue();
    //some code here to pop the unwanted values out
    
    combo.setValue(values)

  3. #2
    Ext JS Premium Member tvanzoelen's Avatar
    Join Date
    Apr 2008
    Location
    Groningen - Netherlands
    Posts
    1,114
    Answers
    83
    Vote Rating
    30
    tvanzoelen has a spectacular aura about tvanzoelen has a spectacular aura about tvanzoelen has a spectacular aura about

      0  

    Default


    What does getValue() returns an array? Then pop the default value out of that array and set the array again with setValue()

    Code:
    var values = combo.getValue();
    //some code here to pop the unwanted values out
    
    combo.setValue(values)

  4. #3
    Sencha - Community Support Team sword-it's Avatar
    Join Date
    May 2012
    Location
    Istanbul
    Posts
    1,333
    Answers
    124
    Vote Rating
    85
    sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough

      0  

    Default


    HI!

    you may use clearValue() for your combo to clear default value.

    Code:
    yourCombo.clearValue();
    check this for detailed information:-
    http://docs.sencha.com/ext-js/4-1/#!...hod-clearValue
    sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.

  5. #4
    Sencha User
    Join Date
    May 2010
    Location
    Belgium
    Posts
    206
    Answers
    3
    Vote Rating
    1
    marxan is on a distinguished road

      0  

    Default


    The problem with getValue is that I get all the values selected in the combo however I only need the value that has been clicked.

    Is there a method to do that, can't find it in the API.

    Thanks

  6. #5
    Sencha Premium Member dawesi's Avatar
    Join Date
    Mar 2007
    Location
    Melbourne, Australia (aka GMT+10)
    Posts
    1,083
    Answers
    24
    Vote Rating
    44
    dawesi has a spectacular aura about dawesi has a spectacular aura about

      0  

    Default


    put multiSelect:false in your config
    Teahouse Training Company
    Official Certified Sencha Trainer

    Australia / New Zealand / Singapore / Hong Kong & APAC



    SenchaWorld.com - Sencha webinars, videos, etc
    SenchaForge.org - (coming soon)
    TeahouseHQ.com - Sencha ecosystem training portal

    Code Validation : JSLint | JSONLint | JSONPLint

  7. #6
    Sencha User
    Join Date
    May 2010
    Location
    Belgium
    Posts
    206
    Answers
    3
    Vote Rating
    1
    marxan is on a distinguished road

      0  

    Default


    but I need the multiselect: true.

    What I want is to get the value that has been clicked and not all the value selected in the combo.

  8. #7
    Ext JS Premium Member tvanzoelen's Avatar
    Join Date
    Apr 2008
    Location
    Groningen - Netherlands
    Posts
    1,114
    Answers
    83
    Vote Rating
    30
    tvanzoelen has a spectacular aura about tvanzoelen has a spectacular aura about tvanzoelen has a spectacular aura about

      0  

    Default


    That the last one in the list

  9. #8
    Sencha User
    Join Date
    May 2010
    Location
    Belgium
    Posts
    206
    Answers
    3
    Vote Rating
    1
    marxan is on a distinguished road

      0  

    Default


    Still a problem if I use the last value in the list. I also have to deselect a value. So it won't be in the list anymore and I don't know which value I have deselect.