Skip to content

Commit 59f184d

Browse files
authored
fix #971 (#986)
1 parent 643b9bc commit 59f184d

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

packages/react-bootstrap-table2-filter/src/components/multiselect.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,18 @@ function optionsEquals(currOpts, prevOpts) {
1818
return Object.keys(currOpts).length === Object.keys(prevOpts).length;
1919
}
2020

21-
const getSelections = container =>
22-
Array.from(container.selectedOptions).map(item => item.value);
21+
const getSelections = (container) => {
22+
if (container.selectedOptions) {
23+
return Array.from(container.selectedOptions).map(item => item.value);
24+
}
25+
const selections = [];
26+
const totalLen = container.options.length;
27+
for (let i = 0; i < totalLen; i += 1) {
28+
const option = container.options.item(i);
29+
if (option.selected) selections.push(option.value);
30+
}
31+
return selections;
32+
};
2333

2434
class MultiSelectFilter extends Component {
2535
constructor(props) {

0 commit comments

Comments
 (0)