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
size and data-size not always working #31
Comments
Have you tried to apply seletpicker after changing your DOM? try execute |
I wish I can do that but I'm using this at a Backbone.View on the render method and kind of calling .selectpicker inside the method, and the element is added to the DOM later, not by the View itself. |
Confirmed that executing this again does not fix the size issue. |
Also confirmed that commit 1c22c037178756ac894035bbbf2973887560e71a does not fix the size refresh problem. |
Don't mean to be a pest, but any plans on fixing this bug? |
Just looking at this for first time...
This is both browser and setting dependent, so it could be An empty string, or So if you dont set the line-height to a int value, and you set data-size or data you will see this issue. Can we not just use |
In fact, why does it need the combination of Can it not just use knocked a fiddle showing the issues: http://jsfiddle.net/Msyym/ m. |
That works if the menu is already displayed, but liHeight is calculated when the select is first created (while the menu is hidden), meaning |
While I think |
Hey @caseyjhol, the most recent changes still don't solve my problem. Maybe it is different than what @dfliess described above. I set size to 10 and with 10 options present, I add an 11th element with the following:
I know that the size only gets calculated in the init method. Can you think of a clean way to "refresh" the control after adding/removing a new element? (Maybe moving the size calculation code into its own method that can be called from the refresh or reloadLi methods?) |
So there are 2 common practices to make bootstrap type dropdowns. First is to use a select and the second is to a ul and li options (data toggle and dropdown-menu). When you use the select version, the first time the dropdown is expanded a ul is created with all li options having the values from the select options tags. There are now 2 lists in your page DOM. The ul li list and the original select. When you continue to play with the dropdown you will see the li class gets "selected" added to the option you picked, however the original select remains unchanged. The chrome dev tools shows this nicely by highlighting what has changed. This is probably why the size doesn't take effect immediately, bc it has to create the ul li list first. Why not does init? who knows.. |
I Think that the size option stopped working for element's that have not been attached to the DOM.
For what I've seen without knowing the full code the issue could be in line 31
var liHeight = parseInt(menuA.css('line-height')) + menuA.outerHeight(); //NaN
.css('line-height') is "".
At least on Chrome v23.0.1271.101:
$('').css('line-height')
I've patched by the moment with a default value like this:
var liHeight = parseInt(menuA.css('line-height'),10)||25 + menuA.outerHeight();
I know it's not the perfect solution....but not sure how to fix it.
The text was updated successfully, but these errors were encountered: