Skip to content

How to programmatically clear the combobox? #146

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
mrbelk opened this issue Aug 11, 2014 · 1 comment
Open

How to programmatically clear the combobox? #146

mrbelk opened this issue Aug 11, 2014 · 1 comment

Comments

@mrbelk
Copy link

mrbelk commented Aug 11, 2014

What is the accepted method for programmatically clearing the selection from the widget? I tried "toggle," "clearElement," and "clearTarget" but all of those caused extra down-carets to be rendered and the behavior after that was wrong.

Thanks.

@mikeblum
Copy link

I wrote a custom method to do this:

  • clear the value
  • update the list
    *don't apply focus
, clear: function(){
            this.$element.val('');
            this.source = this.parse();
            this.options.items = this.source.length;
        }

use it like this:

this.$('select').data('combobox').clear();

To progrmatically update the combobox use this (see issue #75 ):

//fix for getting combobox to accept the value
this.$('select').data('combobox').refresh();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants