Open Vbahole opened 8 years ago
I'm pretty late to the party, but what you're doing sounds a lot like what I'm doing. Here's what I did, and it seems to work fine.
select.combobox('refresh');
select.combobox('clearElementNoFocus'); //Make the Xs go away
select.combobox('clearTarget'); //Clear the field of its value
select.trigger('change'); //Trigger a change event in case there are other fields dependent upon this field's value that will now also need to be cleared. This one is more specific to my scenario and doesn't actually have anything to do with combobox
Note that "clearElementNoFocus" is just a copy of "clearElement" I made that doesn't give focus to the cleared element because I sometimes have up to 5 fields being cleared out because of a single option that changed.
I build 3 combos but i only fill the first in mvc. then on the client i use ajax to fill the other two as they are selected on change. But i'm having issues with the X icon showing up and also emptying the combos when there are change events to prior (uphill) combos. If i fill the select client side the combo will not refresh until i call:
.data('combobox').refresh();
but after i call that the icon on the right side turns to an X - which indicates that a value has been selected, instead of a down carat. if i don't call refresh the values will not change at all. if i call .empty() on an established combo it doesn't clear the values. But if i add a single, non-null, new value then they will be cleared and the new single value is present