Fix more selection bugs

This commit is contained in:
Duncan Sommerville 2015-08-18 18:01:12 -04:00
parent 5f4935481a
commit e7367c3374
1 changed files with 4 additions and 10 deletions

View File

@ -292,7 +292,7 @@ var AIRTIME = (function(AIRTIME) {
mod.uncheckItem = function($el) { mod.uncheckItem = function($el) {
$el.find(".library_checkbox > input").prop('checked', false); $el.find(".library_checkbox > input").prop('checked', false);
if ($("." + LIB_SELECTED_CLASS.length == 0)) { if ($("." + LIB_SELECTED_CLASS).length == 0) {
$("#super-checkbox").prop("checked", false); $("#super-checkbox").prop("checked", false);
} }
}; };
@ -308,6 +308,7 @@ var AIRTIME = (function(AIRTIME) {
mod.selectItem = function($el) { mod.selectItem = function($el) {
mod.highlightItem($el); mod.highlightItem($el);
mod.addToChosen($el); mod.addToChosen($el);
mod.checkItem($el);
// Remember this row so we can properly multiselect // Remember this row so we can properly multiselect
$previouslySelected = $el; $previouslySelected = $el;
@ -317,6 +318,7 @@ var AIRTIME = (function(AIRTIME) {
mod.deselectItem = function($el) { mod.deselectItem = function($el) {
mod.unHighlightItem($el); mod.unHighlightItem($el);
mod.removeFromChosen($el); mod.removeFromChosen($el);
mod.uncheckItem($el);
mod.checkToolBarIcons(); mod.checkToolBarIcons();
}; };
@ -324,6 +326,7 @@ var AIRTIME = (function(AIRTIME) {
$els.each(function(i, el){ $els.each(function(i, el){
mod.highlightItem($(el)); mod.highlightItem($(el));
mod.addToChosen($(el)); mod.addToChosen($(el));
mod.checkItem($(el));
}); });
$previouslySelected = $els.last(); $previouslySelected = $els.last();
mod.checkToolBarIcons(); mod.checkToolBarIcons();
@ -862,17 +865,14 @@ var AIRTIME = (function(AIRTIME) {
if ($previouslySelected.prevAll("#" + $rowId).length !== 0) { if ($previouslySelected.prevAll("#" + $rowId).length !== 0) {
$previouslySelected.prevUntil($tr).each(function (i, el) { $previouslySelected.prevUntil($tr).each(function (i, el) {
mod.selectItem($(el)); mod.selectItem($(el));
mod.checkItem($(el));
}); });
} else { } else {
$previouslySelected.nextUntil($tr).each(function (i, el) { $previouslySelected.nextUntil($tr).each(function (i, el) {
mod.selectItem($(el)); mod.selectItem($(el));
mod.checkItem($(el));
}); });
} }
} }
mod.selectItem($tr); mod.selectItem($tr);
mod.checkItem($tr);
} else { } else {
flagForDeselection = true; flagForDeselection = true;
} }
@ -894,12 +894,10 @@ var AIRTIME = (function(AIRTIME) {
if ($previouslySelected.prevAll("#" + $rowId).length !== 0) { if ($previouslySelected.prevAll("#" + $rowId).length !== 0) {
$previouslySelected.prevUntil($tr).each(function (i, el) { $previouslySelected.prevUntil($tr).each(function (i, el) {
mod.selectItem($(el)); mod.selectItem($(el));
mod.checkItem($(el));
}); });
} else { } else {
$previouslySelected.nextUntil($tr).each(function (i, el) { $previouslySelected.nextUntil($tr).each(function (i, el) {
mod.selectItem($(el)); mod.selectItem($(el));
mod.checkItem($(el));
}); });
} }
} else if (!ev.ctrlKey) { } else if (!ev.ctrlKey) {
@ -907,7 +905,6 @@ var AIRTIME = (function(AIRTIME) {
} }
mod.selectItem($tr); mod.selectItem($tr);
mod.checkItem($tr);
} else if (ev.ctrlKey) { } else if (ev.ctrlKey) {
mod.deselectItem($tr); mod.deselectItem($tr);
} }
@ -915,11 +912,9 @@ var AIRTIME = (function(AIRTIME) {
$libTable.find("tbody").on("click", "tr > td.library_checkbox", function() { $libTable.find("tbody").on("click", "tr > td.library_checkbox", function() {
var tr = $(this).parent(); var tr = $(this).parent();
if (flagForDeselection) { if (flagForDeselection) {
flagForDeselection = false; flagForDeselection = false;
mod.deselectItem(tr); mod.deselectItem(tr);
mod.uncheckItem(tr);
} else { } else {
mod.checkItem(tr); mod.checkItem(tr);
} }
@ -931,7 +926,6 @@ var AIRTIME = (function(AIRTIME) {
mod.selectNone(); mod.selectNone();
mod.selectItem(tr); mod.selectItem(tr);
} }
mod.checkItem(tr);
}); });
$libTable.find("thead").on("click", "th > input[type='checkbox']", function() { $libTable.find("thead").on("click", "th > input[type='checkbox']", function() {