Fix add/remove content dialog, try to increase speed of selection/deselection

This commit is contained in:
Duncan Sommerville 2015-08-18 17:46:16 -04:00
parent a84c33f0ed
commit 0ad51dae09
5 changed files with 62 additions and 60 deletions

View file

@ -320,24 +320,35 @@ var AIRTIME = (function(AIRTIME) {
mod.checkToolBarIcons();
};
mod.selectAll = function($els) {
$els.each(function(i, el){
mod.highlightItem(el);
mod.addToChosen(el);
});
$previouslySelected = $els.last();
mod.checkToolBarIcons();
};
mod.deselectAll = function($els) {
$els.each(function(i, el){
mod.unHighlightItem(el);
mod.removeFromChosen(el);
});
$previouslySelected = undefined;
mod.checkToolBarIcons();
};
/*
* selects all items which the user can currently see. (behaviour taken from
* gmail)
*
*
* by default the items are selected in reverse order so we need to reverse
* it back
*/
mod.selectCurrentPage = function() {
$.fn.reverse = [].reverse;
var $trs = $libTable.find("tbody").find("tr").reverse();
$trs.each(function(i, el){
mod.selectItem($(el));
mod.checkItem($(el));
});
mod.checkToolBarIcons();
mod.selectAll($trs);
};
/*
@ -346,26 +357,13 @@ var AIRTIME = (function(AIRTIME) {
*/
mod.deselectCurrentPage = function() {
var $trs = $libTable.find("tr");
$trs.each(function(i, el){
mod.deselectItem($(el));
mod.uncheckItem($(el));
});
mod.checkToolBarIcons();
mod.selectAll($trs);
};
mod.selectNone = function() {
var $trs = $libTable.find("tr");
$trs.each(function(i, el){
mod.deselectItem($(el));
mod.uncheckItem($(el));
});
$previouslySelected = undefined;
chosenItems = {};
mod.checkToolBarIcons();
mod.deselectAll($trs);
};
mod.fnRedraw = function() {