bootstrap-fullscreen-select
bootstrap-fullscreen-select copied to clipboard
Multiple selection count issue
After selecting multiple options , the select box shows the length of total characters instead of selected element count
After testing the code I found that this issue can fix by changing the " _updateBtnCount " function. (Line no 185) as below.
b = this.$triggerElement.next().find('option:selected').text() || this.$e.val();
into
b = this.$e.val();
Of course I had to add another variable to fix if the user select only one element from a multiple selection. so finally it was like below `_updateBtnCount: function () {
/*
* Update generated button count.
*/
if (this.$triggerElement.is('button') && this.$triggerElement.hasClass('btn-mobileSelect-gen')) {
var a = this.$triggerElement.find('.text'),
b = this.$e.val();//this.$triggerElement.next().find('option:selected').text() || this.$e.val();
var btext = this.$triggerElement.next().find('option:selected').text();
if (b === null) {
a.html('Nothing selected');
return false;
}
if (this.isMultiple) {console.log(btext);
if (b.length === 1) {
a.html(btext);
} else {
a.html(b.length + ' items selected');
}
} else {console.log(b);
a.html(b);
}
}
},`