CC-6067 - implement hybrid selection
This commit is contained in:
parent
4bfb8fa0cb
commit
263c2709bf
|
@ -836,8 +836,8 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
AIRTIME.library.dblClickAdd(data, data.ftype);
|
AIRTIME.library.dblClickAdd(data, data.ftype);
|
||||||
});
|
});
|
||||||
|
|
||||||
$libTable.find("tbody").on("mousedown", "tr", function(ev) {
|
$libTable.find("tbody").on("mousedown", "tr > td.library_checkbox", function(ev) {
|
||||||
var $tr = $(this),
|
var $tr = $(this).parent(),
|
||||||
// Get the ID of the selected row
|
// Get the ID of the selected row
|
||||||
$rowId = $tr.attr("id");
|
$rowId = $tr.attr("id");
|
||||||
|
|
||||||
|
@ -871,19 +871,53 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
$previouslySelected = $tr;
|
$previouslySelected = $tr;
|
||||||
});
|
});
|
||||||
|
|
||||||
$libTable.find("tbody").on("click", "tr", function(ev) {
|
$libTable.find("tbody").on("mousedown", "tr > td:not(.library_checkbox)", function(ev) {
|
||||||
//ev.preventDefault();
|
var $tr = $(this).parent(),
|
||||||
|
// Get the ID of the selected row
|
||||||
|
$rowId = $tr.attr("id");
|
||||||
|
|
||||||
|
if (ev.shiftKey && $previouslySelected !== undefined) {
|
||||||
|
if ($previouslySelected.attr("id") == $rowId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the selected row comes before the previously selected row,
|
||||||
|
// we want to select previous rows, otherwise we select next
|
||||||
|
if ($previouslySelected.prevAll("#" + $rowId).length !== 0) {
|
||||||
|
$previouslySelected.prevUntil($tr).each(function (i, el) {
|
||||||
|
mod.selectItem($(el));
|
||||||
|
mod.checkItem($(el));
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
$previouslySelected.nextUntil($tr).each(function (i, el) {
|
||||||
|
mod.selectItem($(el));
|
||||||
|
mod.checkItem($(el));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else if (!ev.ctrlKey) {
|
||||||
|
AIRTIME.library.selectNone();
|
||||||
|
}
|
||||||
|
|
||||||
|
mod.selectItem($tr);
|
||||||
|
mod.checkItem($tr);
|
||||||
|
|
||||||
|
// Remember this row so we can properly multiselect
|
||||||
|
$previouslySelected = $tr;
|
||||||
|
});
|
||||||
|
|
||||||
|
$libTable.find("tbody").on("click", "tr", function() {
|
||||||
|
var tr = $(this);
|
||||||
|
|
||||||
if (flagForDeselection) {
|
if (flagForDeselection) {
|
||||||
flagForDeselection = false;
|
flagForDeselection = false;
|
||||||
mod.deselectItem($(this));
|
mod.deselectItem(tr);
|
||||||
mod.uncheckItem($(this));
|
mod.uncheckItem(tr);
|
||||||
} else {
|
} else {
|
||||||
mod.checkItem($(this));
|
mod.checkItem(tr);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$libTable.find("thead").on("click", "th > input[type='checkbox']", function(ev) {
|
$libTable.find("thead").on("click", "th > input[type='checkbox']", function() {
|
||||||
if ($(this).is(":checked")) {
|
if ($(this).is(":checked")) {
|
||||||
AIRTIME.library.selectCurrentPage();
|
AIRTIME.library.selectCurrentPage();
|
||||||
$(this).prop("checked", true);
|
$(this).prop("checked", true);
|
||||||
|
|
|
@ -436,6 +436,8 @@ var AIRTIME = (function(AIRTIME){
|
||||||
* Should all be moved to builder.js eventually
|
* Should all be moved to builder.js eventually
|
||||||
*/
|
*/
|
||||||
function buildNewTab(json) {
|
function buildNewTab(json) {
|
||||||
|
AIRTIME.library.selectNone();
|
||||||
|
|
||||||
var tabId = $openTabs[json.type + json.id];
|
var tabId = $openTabs[json.type + json.id];
|
||||||
if (tabId !== undefined) {
|
if (tabId !== undefined) {
|
||||||
AIRTIME.showbuilder.switchTab($("#pl-tab-content-" + tabId), $("#pl-tab-" + tabId));
|
AIRTIME.showbuilder.switchTab($("#pl-tab-content-" + tabId), $("#pl-tab-" + tabId));
|
||||||
|
|
Loading…
Reference in New Issue