Skip to content
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

Header height is zero when searchField is false #98

Open
oscarcosta opened this issue Mar 7, 2015 · 1 comment
Open

Header height is zero when searchField is false #98

oscarcosta opened this issue Mar 7, 2015 · 1 comment

Comments

@oscarcosta
Copy link

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.

@slovdahl
Copy link

slovdahl commented Sep 7, 2016

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.

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