select with shift chromium

This commit is contained in:
Cayo Puigdefabregas 2022-06-08 10:16:15 +02:00
parent 92fafa2358
commit 070771c077
1 changed files with 23 additions and 1 deletions

View File

@ -13,7 +13,8 @@ $(document).ready(() => {
newTrade(show_trade_form);
} else {
$(".deviceSelect").on("change", deviceSelect);
}
};
select_shift();
// $('#selectLot').selectpicker();
})
@ -229,6 +230,27 @@ function addTag() {
$("#addTagAlertModal").click();
}
function select_shift() {
const chkboxes = $('.deviceSelect');
lastChecked = null;
chkboxes.click(function(e) {
if (!lastChecked) {
lastChecked = this;
return;
}
if (e.shiftKey) {
var start = chkboxes.index(this);
var end = chkboxes.index(lastChecked);
chkboxes.slice(Math.min(start,end), Math.max(start,end)+ 1).prop('checked', lastChecked.checked);
}
lastChecked = this;
});
selectorController("softInit");
}
function newTrade(action) {
let title = "Trade "
const user_to = $("#user_to").data("email");