fix this calls of dashboard.js class
and autoreload of tables
This commit is contained in:
parent
76f5c36ba1
commit
4c018d567a
@ -30,6 +30,7 @@ class Dashboard {
|
|||||||
/* Btn Action Listeners */
|
/* Btn Action Listeners */
|
||||||
|
|
||||||
addClickListeners() {
|
addClickListeners() {
|
||||||
|
const _this = this;
|
||||||
//btn listeners
|
//btn listeners
|
||||||
$('#logoutbtn').click(function () {
|
$('#logoutbtn').click(function () {
|
||||||
$.post('/senddata/checkloginstate', 'action=logout', function (data) {
|
$.post('/senddata/checkloginstate', 'action=logout', function (data) {
|
||||||
@ -60,7 +61,7 @@ class Dashboard {
|
|||||||
console.log('Popup closed. ')
|
console.log('Popup closed. ')
|
||||||
|
|
||||||
});
|
});
|
||||||
this.reloadtable();
|
_this.reloadtable();
|
||||||
} else if (data.status == "exists") {
|
} else if (data.status == "exists") {
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
type: "warning",
|
type: "warning",
|
||||||
@ -181,7 +182,7 @@ class Dashboard {
|
|||||||
zone.html("Select Zone");
|
zone.html("Select Zone");
|
||||||
wastetype.html("Select waste type");
|
wastetype.html("Select waste type");
|
||||||
date.val("");
|
date.val("");
|
||||||
reloadDateTable();
|
_this.reloadDateTable();
|
||||||
} else if (data.status == "citydoesntexist") {
|
} else if (data.status == "citydoesntexist") {
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
type: "warning",
|
type: "warning",
|
||||||
@ -233,9 +234,10 @@ class Dashboard {
|
|||||||
}
|
}
|
||||||
|
|
||||||
reloadtable() {
|
reloadtable() {
|
||||||
|
const _this = this;
|
||||||
$.post('/senddata/wastedata', 'action=getAllCities', function (data) {
|
$.post('/senddata/wastedata', 'action=getAllCities', function (data) {
|
||||||
if (this.citytable != null) {
|
if (_this.citytable != null) {
|
||||||
this.citytable.destroy(); //delete table if already created
|
_this.citytable.destroy(); //delete table if already created
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(data);
|
console.log(data);
|
||||||
@ -287,7 +289,7 @@ class Dashboard {
|
|||||||
}, "json");
|
}, "json");
|
||||||
});
|
});
|
||||||
|
|
||||||
this.citytable = $("#example2").DataTable();
|
_this.citytable = $("#example2").DataTable();
|
||||||
} else if (data.query == "nodbconn") {
|
} else if (data.query == "nodbconn") {
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
type: "error",
|
type: "error",
|
||||||
@ -305,9 +307,10 @@ class Dashboard {
|
|||||||
}
|
}
|
||||||
|
|
||||||
reloadDateTable() {
|
reloadDateTable() {
|
||||||
|
const _this = this;
|
||||||
$.post('/senddata/wastedata', 'action=getAllDates', function (data) {
|
$.post('/senddata/wastedata', 'action=getAllDates', function (data) {
|
||||||
if (this.datetable != null) {
|
if (_this.datetable != null) {
|
||||||
this.datetable.destroy(); //delete table if already created
|
_this.datetable.destroy(); //delete table if already created
|
||||||
}
|
}
|
||||||
console.log(data);
|
console.log(data);
|
||||||
|
|
||||||
@ -356,7 +359,7 @@ class Dashboard {
|
|||||||
}, "json");
|
}, "json");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.datetable = $("#table-pickupdates").DataTable({
|
_this.datetable = $("#table-pickupdates").DataTable({
|
||||||
"order": [[3, "asc"]]
|
"order": [[3, "asc"]]
|
||||||
});
|
});
|
||||||
}, "json");
|
}, "json");
|
||||||
|
Loading…
Reference in New Issue
Block a user