Add "Reset Sorting" button to remaining pages.

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2019-12-20 08:35:29 +00:00
parent 4f54796286
commit ede9d41341
7 changed files with 52 additions and 4 deletions

View File

@@ -55,6 +55,7 @@
<table id="adlistsTable" class="display table table-striped table-bordered" cellspacing="0" width="100%">
<thead>
<tr>
<th>ID</th>
<th>Address</th>
<th>Status</th>
<th>Comment</th>
@@ -63,6 +64,7 @@
</tr>
</thead>
</table>
<button type="button" id="resetButton" hidden="true">Reset sorting</button>
</div>
<!-- /.box-body -->
</div>

View File

@@ -57,12 +57,14 @@
<table id="clientsTable" class="display table table-striped table-bordered" cellspacing="0" width="100%">
<thead>
<tr>
<th>ID</th>
<th>IP address</th>
<th>Group assignment</th>
<th>Action</th>
</tr>
</thead>
</table>
<button type="button" id="resetButton" hidden="true">Reset sorting</button>
</div>
<!-- /.box-body -->
</div>

View File

@@ -64,6 +64,7 @@
<table id="domainsTable" class="display table table-striped table-bordered" cellspacing="0" width="100%">
<thead>
<tr>
<th>ID</th>
<th>Domain</th>
<th>Type</th>
<th>Status</th>
@@ -73,6 +74,7 @@
</tr>
</thead>
</table>
<button type="button" id="resetButton" hidden="true">Reset sorting</button>
</div>
<!-- /.box-body -->
</div>

View File

@@ -99,6 +99,7 @@ function initTable() {
},
order: [[0, "asc"]],
columns: [
{ data: "id", visible: false },
{ data: "address" },
{ data: "enabled", searchable: false },
{ data: "comment" },
@@ -201,6 +202,19 @@ function initTable() {
return data;
}
});
table.on("order.dt", function() {
var order = table.order();
if (order[0][0] !== 0 || order[0][1] !== "asc") {
$("#resetButton").show();
} else {
$("#resetButton").hide();
}
});
$("#resetButton").on("click", function() {
table.order([[0, "asc"]]).draw();
$("#resetButton").hide();
});
}
function addAdlist() {

View File

@@ -127,6 +127,7 @@ function initTable() {
},
order: [[0, "asc"]],
columns: [
{ data: "id", visible: false },
{ data: "ip" },
{ data: "groups", searchable: false },
{ data: "name", width: "80px", orderable: false }
@@ -209,6 +210,19 @@ function initTable() {
return data;
}
});
table.on("order.dt", function() {
var order = table.order();
if (order[0][0] !== 0 || order[0][1] !== "asc") {
$("#resetButton").show();
} else {
$("#resetButton").hide();
}
});
$("#resetButton").on("click", function() {
table.order([[0, "asc"]]).draw();
$("#resetButton").hide();
});
}
function addClient() {

View File

@@ -99,6 +99,7 @@ function initTable() {
},
order: [[0, "asc"]],
columns: [
{ data: "id", visible: false },
{ data: "domain" },
{ data: "type", searchable: false },
{ data: "enabled", searchable: false },
@@ -218,6 +219,19 @@ function initTable() {
return data;
}
});
table.on("order.dt", function() {
var order = table.order();
if (order[0][0] !== 0 || order[0][1] !== "asc") {
$("#resetButton").show();
} else {
$("#resetButton").hide();
}
});
$("#resetButton").on("click", function() {
table.order([[0, "asc"]]).draw();
$("#resetButton").hide();
});
}
function addDomain() {

View File

@@ -65,10 +65,6 @@ function datetime(date) {
$(document).ready(function() {
$("#btnAdd").on("click", addGroup);
$("#resetButton").on("click", function() {
table.order([[0, "asc"]]).draw();
$("#resetButton").hide();
});
table = $("#groupsTable").DataTable({
ajax: {
@@ -173,6 +169,10 @@ $(document).ready(function() {
$("#resetButton").hide();
}
});
$("#resetButton").on("click", function() {
table.order([[0, "asc"]]).draw();
$("#resetButton").hide();
});
});
function addGroup() {