Fix more selection bugs

This commit is contained in:
Duncan Sommerville 2015-08-21 14:39:30 -04:00
parent 6cfc2db0ca
commit b15160d0fb
3 changed files with 29 additions and 14 deletions

View File

@ -1836,7 +1836,7 @@ button, input {
font-weight: bold;
}
.user-list-wrapper .ui-widget-header:first-child .dataTables_filter {
/*margin:0;*/
margin:0;
}
.user-management h2 {
font-size: 1.7em;

View File

@ -870,6 +870,12 @@ var AIRTIME = (function(AIRTIME) {
// Get the ID of the selected row
$rowId = $tr.attr("id");
if (ev.which === 3 /* Right click */) {
mod.selectNone();
mod.selectItem($tr);
return;
}
if (!$tr.hasClass(LIB_SELECTED_CLASS)) {
if (ev.shiftKey && $previouslySelected !== undefined) {
if ($previouslySelected.attr("id") == $rowId) {
@ -893,10 +899,7 @@ var AIRTIME = (function(AIRTIME) {
mod.selectItem($tr);
} else if (ev.ctrlKey) {
mod.deselectItem($tr);
} else if (ev.which === 3 /* Right click */) {
mod.selectNone();
mod.selectItem($tr);
flagForDeselection = true;
}
});
@ -913,7 +916,11 @@ var AIRTIME = (function(AIRTIME) {
$libTable.find("tbody").on("click", "tr > td:not(.library_checkbox)", function(e) {
var tr = $(this).parent();
if (!(e.shiftKey || e.ctrlKey)) {
if (flagForDeselection) {
flagForDeselection = false;
$previouslySelected = undefined;
mod.deselectItem(tr);
} else if (!(e.shiftKey || e.ctrlKey)) {
mod.selectNone();
mod.selectItem(tr);
}

View File

@ -824,6 +824,14 @@ var AIRTIME = (function(AIRTIME){
// Get the ID of the selected row
$rowId = $tr.attr("id");
if (ev.which === 3 /* Right click */) {
mod.selectNone();
$tr.addClass(SB_SELECTED_CLASS);
$tr.find(".sb-checkbox > input").prop('checked', true);
mod.checkToolBarIcons();
return;
}
if (!$tr.hasClass(SB_SELECTED_CLASS)) {
if (ev.shiftKey && $previouslySelected !== undefined) {
if ($previouslySelected.attr("id") == $rowId) {
@ -851,13 +859,7 @@ var AIRTIME = (function(AIRTIME){
$tr.find(".sb-checkbox > input").prop('checked', true);
mod.checkToolBarIcons();
} else if (ev.ctrlKey) {
$tr.removeClass(SB_SELECTED_CLASS);
$tr.find(".sb-checkbox > input").prop('checked', false);
} else if (ev.which === 3 /* Right click */) {
mod.selectNone();
$tr.addClass(SB_SELECTED_CLASS);
$tr.find(".sb-checkbox > input").prop('checked', true);
mod.checkToolBarIcons();
flagForDeselection = true;
}
selectedRows = $("." + SB_SELECTED_CLASS);
@ -882,7 +884,13 @@ var AIRTIME = (function(AIRTIME){
$sbTable.find("tbody").on("click", "tr:not(.sb-header, .sb-footer, .sb-past, .sb-empty, :has(td.dataTables_empty)) > td:not(.sb-checkbox)", function(e) {
var tr = $(this).parent();
if (!(e.shiftKey || e.ctrlKey)) {
if (flagForDeselection) {
flagForDeselection = false;
$previouslySelected = undefined;
tr.removeClass(SB_SELECTED_CLASS);
tr.find(".sb-checkbox > input").prop('checked', false);
mod.checkToolBarIcons();
} else if (!(e.shiftKey || e.ctrlKey)) {
mod.selectNone();
tr.addClass(SB_SELECTED_CLASS);
tr.find(".sb-checkbox > input").prop('checked', true);