Open oscarcosta opened 9 years ago
This seems to be caused by the _updateHeaders
method not being called before _resize
is invoked. I worked around it locally by inserting a second call to _resize
in refresh
like this:
refresh: function(callback) {
this._resize(); // just make sure we display the widget right without delay
asyncFunction(function() {
this.optionCache.cleanup();
var opt, options = this.element[0].childNodes;
for (var i=0, l1=options.length; i<l1; i++) {
opt = options[i];
if (opt.nodeType === 1) {
if (opt.tagName.toUpperCase() === 'OPTGROUP') {
var optGroup = $(opt).data('option-group') || (PRE_OPTGROUP + (this.optionGroupIndex++));
var grpOptions = opt.childNodes;
this.optionCache.prepareGroup($(opt), optGroup);
for (var j=0, l2=grpOptions.length; j<l2; j++) {
opt = grpOptions[j];
if (opt.nodeType === 1) {
this.optionCache.prepareOption($(opt), optGroup);
}
}
} else {
this.optionCache.prepareOption($(opt)); // add to default group
}
}
}
this.optionCache.reIndex();
// need to ensure the widget is correctly sized again, the header might have changed
this._resize();
if (this._searchField && this._searchField.is(':visible')) {
this._search(null, true);
}
if (callback) callback();
}, 10, this);
}
Not sure this is the best way of solving it, but at least it works for me.
Hello, I am implementing your widget in a project I am working, and it is very useful, thank! But I figured out that when the "searchField" option is set to false, the height of both headers is set to zero.