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

[#2667]fix the bug of the data-size when the first option style has 'display: none' #2713

Merged
merged 3 commits into from
Mar 2, 2022
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions js/bootstrap-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -1454,7 +1454,7 @@
buildData: function (data, type) {
var dataGetter = data === false ? getOptionData.fromOption : getOptionData.fromDataSource;

var optionSelector = ':not([hidden]):not([data-hidden="true"])',
var optionSelector = ':not([hidden]):not([data-hidden="true"]):not([style*="display: none"])',
mainData = [],
startLen = 0,
optID = 0,
Expand Down Expand Up @@ -1796,7 +1796,7 @@
}
}
} else {
var optionSelector = ':not([hidden]):not([data-hidden="true"]):not([data-divider="true"])';
var optionSelector = ':not([hidden]):not([data-hidden="true"]):not([data-divider="true"]):not([style*="display: none"])';
if (this.options.hideDisabled) optionSelector += ':not(:disabled)';

// If this is a multiselect, and selectedTextFormat is count, then show 1 of 2 selected, etc.
Expand Down Expand Up @@ -1920,7 +1920,7 @@
if (this.selectpicker.current.data.length) {
for (var i = 0; i < this.selectpicker.current.data.length; i++) {
var data = this.selectpicker.current.data[i];
if (data.type === 'option') {
if (data.type === 'option' && $(data.element.firstChild).css('display') !== 'none') {
li = data.element;
break;
}
Expand Down