added ability to select rows when ctrl key is held.

This commit is contained in:
DESKTOP-GENO133\IvanPlex
2024-02-20 20:23:47 -07:00
parent 6af0d8b88e
commit 0088c74b20
10 changed files with 26 additions and 9 deletions

View File

@@ -515,6 +515,12 @@ function addToSelectedRows(id) {
selectedRow.push(id);
}
}
function removeFromSelectedRows(id) {
var rowIndex = selectedRow.findIndex(x => x == id)
if (rowIndex != -1) {
selectedRow.splice(rowIndex, 1);
}
}
function clearSelectedRows() {
selectedRow = [];
$('.table tr').removeClass('table-active');
@@ -545,4 +551,15 @@ function getMenuPosition(mouse, direction, scrollDir) {
if (mouse + menu > win && menu < mouse)
position -= menu;
return position;
}
function handleTableRowClick(e, callBack, rowId) {
if (!event.ctrlKey) {
callBack(rowId);
} else if (!$(e).hasClass('table-active')) {
addToSelectedRows($(e).attr('data-rowId'));
$(e).addClass('table-active');
} else if ($(e).hasClass('table-active')){
removeFromSelectedRows($(e).attr('data-rowId'));
$(e).removeClass('table-active');
}
}