Skip to content

Commit d06aa7e

Browse files
author
Steffen
committed
2 parents 52257ef + 0405f58 commit d06aa7e

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

Resources/views/Action/multiselect_actions.html.twig

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ $(".{{ view_table_id }}_multiselect_checkall").click(function(event) {
2929
});
3030
});
3131

32+
$(selector).on('click', 'input.{{ view_table_id }}_multiselect_checkbox', function(event) {
33+
updateCheckAll();
34+
});
35+
3236
$(".{{ view_table_id }}_multiselect_action_click").on('click', function(event) {
3337
var length = $("input.{{ view_table_id }}_multiselect_checkbox:checkbox:checked").length;
3438

@@ -64,3 +68,20 @@ $(".{{ view_table_id }}_multiselect_action_click").on('click', function(event) {
6468
alert("{{ 'datatables.bulk.selectError'|trans({}, 'messages') }}");
6569
}
6670
});
71+
72+
function updateCheckAll(){
73+
var $individual_all = $("input.{{ view_table_id }}_multiselect_checkbox:checkbox");
74+
var $individual_checked = $("input.{{ view_table_id }}_multiselect_checkbox:checkbox:checked");
75+
var $all = $(".{{ view_table_id }}_multiselect_checkall");
76+
77+
if($individual_checked.length === 0){
78+
$all.prop('checked', false);
79+
$all.prop('indeterminate', false);
80+
} else if ($individual_checked.length === $individual_all.length){
81+
$all.prop('checked', true);
82+
$all.prop('indeterminate', false);
83+
} else {
84+
$all.prop('checked', false);
85+
$all.prop('indeterminate', true);
86+
}
87+
}

0 commit comments

Comments
 (0)