added ability to select bulk data.

This commit is contained in:
DESKTOP-T0O5CDB\DESK-555BD
2024-02-19 16:48:12 -07:00
parent 65f638f336
commit 8b2866b89b
10 changed files with 72 additions and 18 deletions

View File

@@ -327,4 +327,58 @@ function moveRecord(recordId, source, dest) {
$("#workAroundInput").hide();
}
});
}
var selectedRow = [];
var isDragging = false;
$(window).on('mouseup', function (e) {
rangeMouseUp(e);
});
$(window).on('mousedown', function (e) {
rangeMouseDown(e);
});
$(window).on('keydown', function (e) {
if (e.ctrlKey && e.which == 65) {
e.preventDefault();
e.stopPropagation();
selectedRow = [];
$('.vehicleDetailTabContainer .table tbody tr').addClass('table-active');
$('.vehicleDetailTabContainer .table tbody tr').map((index, elem) => {
selectedRow.push($(elem).attr('data-rowId'));
});
}
})
function rangeMouseDown(e) {
if (isRightClick(e)) {
return;
}
if (!e.ctrlKey) {
selectedRow = [];
$('.table tr').removeClass('table-active');
}
isDragging = true;
document.documentElement.onselectstart = function () { return false; };
}
function isRightClick(e) {
if (e.which) {
return (e.which == 3);
} else if (e.button) {
return (e.button == 2);
}
return false;
}
function rangeMouseUp(e) {
if (isRightClick(e)) {
return;
}
isDragging = false;
document.documentElement.onselectstart = function () { return true; };
}
function rangeMouseMove(e) {
if (isDragging) {
if (!$(e).hasClass('table-active')) {
selectedRow.push($(e).attr('data-rowId'));
$(e).addClass('table-active');
}
}
}