From 0bc825947e8544af10eefffea5a05e4cca59b079 Mon Sep 17 00:00:00 2001 From: denise Date: Thu, 28 Jun 2012 11:44:30 -0400 Subject: [PATCH] CC-3995: Media Library -> it takes too long time to switch page or select all from this page if set as displaying 100 item in Media Library. -done --- .../public/js/airtime/library/library.js | 26 ++++++++++++++----- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/airtime_mvc/public/js/airtime/library/library.js b/airtime_mvc/public/js/airtime/library/library.js index 5e286fbc9..2f6910978 100644 --- a/airtime_mvc/public/js/airtime/library/library.js +++ b/airtime_mvc/public/js/airtime/library/library.js @@ -202,13 +202,19 @@ var AIRTIME = (function(AIRTIME) { */ mod.selectCurrentPage = function() { $.fn.reverse = [].reverse; - var $trs = $libTable.find("tbody input:checkbox").parents("tr").reverse(); + var $inputs = $libTable.find("tbody input:checkbox"), + $trs = $inputs.parents("tr").reverse(); + + $inputs.attr("checked", true); + $trs.addClass(LIB_SELECTED_CLASS); $trs.each(function(i, el){ $el = $(this); - - mod.selectItem($el); + mod.addToChosen($el); }); + + mod.checkToolBarIcons(); + }; /* @@ -216,14 +222,20 @@ var AIRTIME = (function(AIRTIME) { * (behaviour taken from gmail) */ mod.deselectCurrentPage = function() { + var $inputs = $libTable.find("tbody input:checkbox"), + $trs = $inputs.parents("tr"), + id; - var $trs = $libTable.find("tbody input:checkbox").filter(":checked").parents("tr"); + $inputs.attr("checked", false); + $trs.removeClass(LIB_SELECTED_CLASS); $trs.each(function(i, el){ $el = $(this); - - mod.deselectItem($el); - }); + id = $el.attr("id"); + delete chosenItems[id]; + }); + + mod.checkToolBarIcons(); }; mod.selectNone = function() {