I have selecting, unselect and unselecting event. But when I click on select all or unselect all none of these events are called.
This is the plugin link http://demos.krajee.com/widget-details/select2
I have selecting, unselect and unselecting event. But when I click on select all or unselect all none of these events are called.
This is the plugin link http://demos.krajee.com/widget-details/select2
There is an event that is fired. Its logic is defined in here:
Select2 Krajee JS Official Source Code
The name of the event for select all is krajeeselect2:selectall
and for unselect all is krajeeselect2:unselectall
.
Consuming the event via JQuery is done as always:
$('#myKartikSelect2Id').on("krajeeselect2:selectall", function (e) {
console.log(e);
});
$('#myKartikSelect2Id').on("krajeeselect2:unselectall", function (e) {
console.log(e);
});
Hope it helps (:
Select All
and UnSelect All
, and krajeeselect2:(un)selectall
does specifically that. The source code has no other event that fires on (un)select all scenarios.
Commented
Jun 1, 2017 at 16:26
I don't find better solution but with this options you can override "Select all" checkbox with empty space.
'toggleAllSettings' => [
'selectLabel' => '',
'unselectLabel' => '',
'selectOptions' => ['class' => 'text-success'],
'unselectOptions' => ['class' => 'text-danger'],
],
Maybe not very correct, but using this works $this->renderAjax()