Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: unchecking select-all checkbox disables spam2 buttons #11069

Merged
merged 2 commits into from
Apr 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions app/assets/javascripts/spam2.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@ function table_main(id) {
"search": "Filter displayed results"
}
});
$('#selectall').click(function () {
$('#selectall').on('click',function () {
$('.selectedId').prop('checked', this.checked);
let selectedLength = $('.selectedId').filter(":checked").length
$('#select-count').text(selectedLength);
if(selectedLength == 0) return
disable_buttons('#selectall');
let selectedLength = $('.selectedId').filter(":checked").length;
$('#select-count').text(selectedLength);
disable_buttons('.selectedId');
});
$('.selectedId').change(function () {
$('.selectedId').on('change', function () {
var check = ($('.selectedId').filter(":checked").length === $('.selectedId').length);
$('#select-count').text($('.selectedId').filter(":checked").length);
$('#selectall').prop("checked", check);
Expand Down Expand Up @@ -70,7 +69,7 @@ function batch_nav(bulk) {

function select_all() {
$('.selectedId').prop('checked', !$('.selectedId').prop('checked'));
let selectedLength = $('.selectedId').filter(":checked").length
let selectedLength = $('.selectedId').filter(":checked").length;
// enable buttons only if there are nodes in the table and number of selected nodes == total node length
var check = (selectedLength == $('.selectedId').length && selectedLength > 0);
$('#select-count').text(selectedLength);
Expand Down