Skip to content

Commit

Permalink
kitodo#3747 improvements of codacy review
Browse files Browse the repository at this point in the history
  • Loading branch information
markusweigelt committed Oct 15, 2021
1 parent 37f0beb commit cb0069e
Showing 1 changed file with 27 additions and 4 deletions.
31 changes: 27 additions & 4 deletions Kitodo/src/main/webapp/WEB-INF/resources/js/lists.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,35 @@ function registerRowToggleEvents(event) {
);
}

$( document ).on( "click", ".allSelectable .ui-chkbox-all .ui-chkbox-box", function() {
PrimeFaces.widget.DataTable.prototype.updateData = (function () {
let cached_function = PrimeFaces.widget.DataTable.prototype.updateData;
return function () {
let reselectAll = (this.selection != undefined && this.selection[0] === '@all');
let result = cached_function.apply(this, arguments);
if (reselectAll) {
this.selectAllRows();
}
return result;
};
})();

$(document).on("click", ".allSelectable .ui-chkbox-all .ui-chkbox-box", function () {
/*global PF*/
/*eslint new-cap: ["error", { "capIsNewExceptionPattern": "^PF" }]*/
if( $(this).hasClass( "ui-state-active" ) ) {
let tableId = $(this).closest(".allSelectable").attr('id').split(":").at(-1);
let table = new PF(tableId);
if ($(this).hasClass("ui-state-active")) {
new PF('allSelectableOverlayPanel').show();
} else {
new PF('processesTable').unselectAllRows();
}
table.unselectAllRows();
});

$(document).on("click", ".allSelectable .ui-chkbox .ui-chkbox-box", function () {
/*global PF*/
/*eslint new-cap: ["error", { "capIsNewExceptionPattern": "^PF" }]*/
let tableId = $(this).closest(".allSelectable").attr('id').split(":").at(-1);
let table = new PF(tableId);
if (table.selection != undefined && table.selection[0] === '@all') {
table.unselectAllRows();
}
});

0 comments on commit cb0069e

Please sign in to comment.