mirror of
https://github.com/sosedoff/pgweb.git
synced 2024-12-14 19:21:46 +03:00
Tweak js formatting, highlight header with sort order
This commit is contained in:
parent
637e7a4e24
commit
ec6bb5590d
File diff suppressed because one or more lines are too long
@ -314,6 +314,15 @@
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
#results th.active {
|
||||
background: #e3e3e3;
|
||||
}
|
||||
|
||||
#results[data-mode="browse"] th:hover {
|
||||
cursor: pointer;
|
||||
background: #fafafa;
|
||||
}
|
||||
|
||||
#results tbody tr:hover td {
|
||||
background: #ffe;
|
||||
}
|
||||
|
@ -98,11 +98,12 @@ function buildTable(results, sortColumn, sortOrder) {
|
||||
var rows = "";
|
||||
|
||||
results.columns.forEach(function(col) {
|
||||
if (col === sortColumn) {
|
||||
cols += "<th data='" + col + "'" + "data-sort-order=" + sortOrder + ">" + col + " " + sortArrow(sortOrder) + "</th>";
|
||||
} else {
|
||||
cols += "<th data='" + col + "'>" + col + "</th>";
|
||||
}
|
||||
if (col === sortColumn) {
|
||||
cols += "<th class='active' data='" + col + "'" + "data-sort-order=" + sortOrder + ">" + col + " " + sortArrow(sortOrder) + "</th>";
|
||||
}
|
||||
else {
|
||||
cols += "<th data='" + col + "'>" + col + "</th>";
|
||||
}
|
||||
});
|
||||
|
||||
results.rows.forEach(function(row) {
|
||||
@ -449,20 +450,21 @@ $(document).ready(function() {
|
||||
});
|
||||
|
||||
$("#results").on("click", "th", function(e) {
|
||||
var sortColumn = this.attributes['data'].value;
|
||||
var contentTab = $('#table_content').hasClass('selected');
|
||||
var sortColumn = this.attributes['data'].value;
|
||||
var contentTab = $('#table_content').hasClass('selected');
|
||||
|
||||
if (!contentTab) {
|
||||
return;
|
||||
}
|
||||
if (!contentTab) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.dataset.sortOrder === "ASC") {
|
||||
this.dataset.sortOrder = "DESC"
|
||||
} else {
|
||||
this.dataset.sortOrder = "ASC"
|
||||
}
|
||||
if (this.dataset.sortOrder === "ASC") {
|
||||
this.dataset.sortOrder = "DESC"
|
||||
}
|
||||
else {
|
||||
this.dataset.sortOrder = "ASC"
|
||||
}
|
||||
|
||||
showTableContent(sortColumn, this.dataset.sortOrder);
|
||||
showTableContent(sortColumn, this.dataset.sortOrder);
|
||||
});
|
||||
|
||||
$("#results").on("dblclick", "td > div", function() {
|
||||
|
Loading…
Reference in New Issue
Block a user