Comments (12)
That works if the menu is already displayed, but liHeight is calculated when the select is first created (while the menu is hidden), meaning outerHeight(true)
doesn't work (returns a value of 6, when the value should be 26). This shouldn't really be an issue, as the line-height is set to 20px in the Bootstrap CSS, so it should never return NaN. Regardless, that whole feature probably needs a revamp, as I haven't really looked at it since I first introduced it at the beginning of December. I'll take a second look to figure out a better implementation.
from bootstrap-select.
Have you tried to apply seletpicker after changing your DOM?
try execute $('.selectpicker').selectpicker();
again
from bootstrap-select.
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.
from bootstrap-select.
Confirmed that executing this again does not fix the size issue.
$('.selectpicker').selectpicker();
from bootstrap-select.
Also confirmed that commit 1c22c037178756ac894035bbbf2973887560e71a does not fix the size refresh problem.
from bootstrap-select.
Don't mean to be a pest, but any plans on fixing this bug?
from bootstrap-select.
Just looking at this for first time...
menuA.css('line-height')
will return the CSS value of the element.
This is both browser and setting dependent, so it could be 25
, '25px'
, or ''
or 'normal'
.
An empty string, or 'normal'
will NOT parse to int with parseInt, you will get NaN.
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 .height();
?
from bootstrap-select.
In fact, why does it need the combination of line-height
and outerHeight()
?
Can it not just use outerHeight(true)
- true to include margins.
knocked a fiddle showing the issues: http://jsfiddle.net/Msyym/
m.
from bootstrap-select.
While I think size
probably needs to be readdressed at some point, this seems to get the job done for now.
from bootstrap-select.
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:
$("#select_list option[value='']").after("<option value='#{value}' class='local'>#{value}</option>")
$("#select_list").selectpicker('reloadLi') # reload the list (IE8 support)
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?)
from bootstrap-select.
HI @kayzee,
Yeah, we could extract the size logic into its own function, and then call that on both init
and a new method that forces a complete re build, such as refresh
, as suggested in #52
m
from bootstrap-select.
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..
This is unfortunate bc now we cannot use this great plugin with selects, only ul lists.
I know this issue was closed a long time ago, but maybe this will shed some light on the issue and help someone find a solution.
from bootstrap-select.
Related Issues (20)
- v1.14.0-beta3 file without "dist" directory HOT 1
- Layout/colors and form floating (bootstrap 5)
- Overlayproblem
- Missing empty line at the end of bootstrap-select.js
- it works very well (bootstrap-select-v1.14.0-beta3-updated and bootstrap 5.3.0) HOT 18
- Opening dropdown does not scroll to selected option first time, but does second time HOT 4
- Select with icon HOT 4
- Button onclick not working in latest version, worked fine in 1.12.4
- [email protected] not working with Bootstrap 5.3.2 HOT 4
- data-selected-text-format after render or refresh
- ADA improvements for Select/deselect all options
- Name of Ukrainian language file is wrong.
- Select does not display in dropdown-menu HOT 1
- is there any feature like select all HOT 1
- Unable to have noneSelectedText with HTML with latest version
- doneButtonText not in i18n files and no longer adjustable via Javascript defaults
- SweetAlert2 - bootstrap select dropdown appears behind/cutoff parent div border HOT 1
- Error when have a class attribute for optgroup tag
- wrong preview for > in <select class="form-control mobileSelect"> in Safari
- Turkish Case Sensitive
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bootstrap-select.