matching selected row colours to the library table.

This commit is contained in:
Naomi 2013-08-23 13:31:37 -04:00
parent 59ba938334
commit f1b1352077
2 changed files with 25 additions and 14 deletions

View File

@ -34,3 +34,10 @@ div.his-timerange div {
table.dataTable tbody tr { table.dataTable tbody tr {
cursor: auto; cursor: auto;
} }
.his-selected.even {
background-color: rgba(240, 109, 53, 1);
}
.his-selected.odd {
background-color: rgba(255, 136, 56, 1);
}

View File

@ -56,22 +56,29 @@ var AIRTIME = (function(AIRTIME) {
return items; return items;
} }
function addSelectedLogItem(id) { function addSelectedLogItem($el) {
var id;
$el.addClass("his-selected");
id = $el.data("his-id");
selectedLogItems[id] = ""; selectedLogItems[id] = "";
} }
function removeSelectedLogItem(id) { function removeSelectedLogItem($el) {
var id;
$el.removeClass("his-selected");
id = $el.data("his-id");
delete selectedLogItems[id]; delete selectedLogItems[id];
} }
function emptySelectedLogItems() { function emptySelectedLogItems() {
var $inputs = $historyContentDiv.find(".his_checkbox").find("input"), var $inputs = $historyContentDiv.find(".his_checkbox").find("input"),
id, $tr, $input; id, $tr, $input;
$inputs.prop('checked', false);
$inputs.parents("tr").removeClass("his-selected");
$.each($inputs, function(index, input) {
$input = $(input);
$input.prop('checked', false);
});
selectedLogItems = {}; selectedLogItems = {};
} }
@ -83,8 +90,7 @@ var AIRTIME = (function(AIRTIME) {
$input = $(input); $input = $(input);
$input.prop('checked', true); $input.prop('checked', true);
$tr = $input.parents("tr"); $tr = $input.parents("tr");
id = $tr.data("his-id"); addSelectedLogItem($tr);
addSelectedLogItem(id);
}); });
} }
@ -96,8 +102,7 @@ var AIRTIME = (function(AIRTIME) {
$input = $(input); $input = $(input);
$input.prop('checked', false); $input.prop('checked', false);
$tr = $input.parents("tr"); $tr = $input.parents("tr");
id = $tr.data("his-id"); removeSelectedLogItem($tr);
removeSelectedLogItem(id);
}); });
} }
@ -470,14 +475,13 @@ var AIRTIME = (function(AIRTIME) {
$historyContentDiv.on("click", ".his_checkbox input", function(e) { $historyContentDiv.on("click", ".his_checkbox input", function(e) {
var checked = e.currentTarget.checked, var checked = e.currentTarget.checked,
$tr = $(e.currentTarget).parents("tr"), $tr = $(e.currentTarget).parents("tr");
id = $tr.data("his-id");
if (checked) { if (checked) {
addSelectedLogItem(id); addSelectedLogItem($tr);
} }
else { else {
removeSelectedLogItem(id); removeSelectedLogItem($tr);
} }
}); });