onSelectAll not fires event when option "Select all" clicked. Only when last option in list is selected event fired. Event not fired when i unselect last option in list.
I am newbie with Javascript, so it may be my mistake, but i check that use last version of <bootstrap-multiselect.js> and i try use simple function like here (https://www.bountysource.com/issues/29165923-why-does-onselectall-function-is-triggered-when-nothing-is-selected).
When i select\unselect "Select All" options in list changed but event not fired.
When all option selected and i unselect one and select it back - event fired. I got message box with text "onSelectAll triggered: deselected all!" ("checked" value is wrong)
When all option unselected and i unselect last one - event not fired.
When i test example here (http://davidstutz.github.io/bootstrap-multiselect/#configuration-options-onSelectAll), i got same effect - "Select All" not fire trigger. And when i unselect and select back one option i got message box with text "onSelectAll triggered: deselected all!", not with "onSelectAll triggered."
It may be bug with my browser (Chrome 50.0.2661.102 m) but i also test with MS Edge 25.10586.0.0 and got same effect.
This is my code:
// get SELECT item
var t_select = $('#tbl-columnList');
// populate select with options - collumns of table in document
$('#report_userActionsLog_table th').each( function(d){
th_el = $(this);
el_text = (th_el.text()? th_el.text(): th_el.children("img").attr("alt"));
t_select.append( '<option value="'+d+'">'+el_text+'</option>' ); });
// init multiselect
t_select.multiselect({
enableFiltering: false,
maxHeight: 700,
nonSelectedText: 'Колонки',
includeSelectAllOption: true,
// this event not work as expected
onSelectAll: function(checked) {
alert('onSelectAll triggered: ' + (checked ? 'selected all' : 'deselected all') + '!');
},
buttonWidth: 158,
templates: {
button: '<button type="button" class="multiselect dropdown-toggle" data-toggle="dropdown"><span class="multiselect-selected-text"></span> <b class="caret"></b></button>',
ul: '<ul class="multiselect-container dropdown-menu" style="width: 200px"></ul>',
filter: '<li class="multiselect-item multiselect-filter"><div class="input-group"><input class="form-control multiselect-search" type="text" style="width: 100px"></div></li>',
filterClearBtn: '<span class="input-group-btn"><button class="btn btn-default multiselect-clear-filter" type="button"><i class="glyphicon glyphicon-remove-circle"></i></button></span>',
li: '<li><a tabindex="0"><label></label></a></li>',
divider: '<li class="multiselect-item divider"></li>',
liGroup: '<li class="multiselect-item multiselect-group"><label></label></li>'
},
// this event work fine
onChange: function(element, checked) {
$('#report_userActionsLog_table').DataTable().column($(element).val()).visible( checked );
}
});
// select all by default
t_select.multiselect('selectAll', false);
t_select.multiselect('updateButtonText');
onSelectAll not fires event when option "Select all" clicked. Only when last option in list is selected event fired. Event not fired when i unselect last option in list.
I am newbie with Javascript, so it may be my mistake, but i check that use last version of <bootstrap-multiselect.js> and i try use simple function like here (https://www.bountysource.com/issues/29165923-why-does-onselectall-function-is-triggered-when-nothing-is-selected).
When i select\unselect "Select All" options in list changed but event not fired.
When all option selected and i unselect one and select it back - event fired. I got message box with text "onSelectAll triggered: deselected all!" ("checked" value is wrong)
When all option unselected and i unselect last one - event not fired.
When i test example here (http://davidstutz.github.io/bootstrap-multiselect/#configuration-options-onSelectAll), i got same effect - "Select All" not fire trigger. And when i unselect and select back one option i got message box with text "onSelectAll triggered: deselected all!", not with "onSelectAll triggered."
It may be bug with my browser (Chrome 50.0.2661.102 m) but i also test with MS Edge 25.10586.0.0 and got same effect.
This is my code: