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