Add possibility to highlight line on the Groups Domain Management page with specifying the domainid as GET parameter.

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2020-01-30 21:03:25 +00:00
parent 2fdc676979
commit a97f52ad76
2 changed files with 31 additions and 0 deletions
+27
View File
@@ -11,6 +11,7 @@ var table;
var groups = [];
var token = $("#token").html();
var info = null;
var GETDict = {};
function showAlert(type, icon, title, message) {
var opts = {};
@@ -88,6 +89,13 @@ function datetime(date) {
}
$(document).ready(function() {
window.location.search
.substr(1)
.split("&")
.forEach(function(item) {
GETDict[item.split("=")[0]] = item.split("=")[1];
});
$("#btnAdd").on("click", addDomain);
get_groups();
@@ -186,6 +194,13 @@ function initTable() {
);
}
// Highlight row
if ("domainid" in GETDict && data.id === parseInt(GETDict.domainid)) {
$(row)
.find("td")
.addClass("highlight");
}
// Select assigned groups
sel.val(data.groups);
// Initialize multiselect
@@ -230,6 +245,18 @@ function initTable() {
data.columns[0].visible = false;
// Apply loaded state to table
return data;
},
initComplete: function() {
if ("domainid" in GETDict) {
var pos = table
.column(0, { order: "current" })
.data()
.indexOf(parseInt(GETDict.domainid));
if (pos >= 0) {
var page = Math.floor(pos / table.page.info().length);
table.page(page).draw(false);
}
}
}
});
+4
View File
@@ -239,3 +239,7 @@
.text-vivid-blue {
color: #36f !important;
}
td.highlight {
background-color: yellow;
}