FIX_POLICY_TRANSACTION_AUTO_RELOAD_ISSUE
This commit is contained in:
parent
21568517c6
commit
3b6aab77ec
@ -359,14 +359,21 @@
|
||||
var endorsementListDataTableUrl = '<?= base_url('policy_tranction/endorsement/list/datatable') ?>';
|
||||
var endorsementClearCacheUrl = '<?= base_url('policy_tranction/endorsement/list/clear-cache') ?>';
|
||||
var endorsementAutoReloadTimer = null;
|
||||
var endorsementTable = null;
|
||||
|
||||
function scheduleEndorsementAutoReload(ms) {
|
||||
if (endorsementAutoReloadTimer) {
|
||||
clearTimeout(endorsementAutoReloadTimer);
|
||||
}
|
||||
if (ms > 0) {
|
||||
console.log('Endorsement auto-reload scheduled in', ms, 'ms (~', Math.round(ms / 1000), 's)');
|
||||
endorsementAutoReloadTimer = setTimeout(function() {
|
||||
window.location.reload();
|
||||
console.log('Endorsement auto-reload fired — refreshing table only');
|
||||
if (endorsementTable) {
|
||||
endorsementTable.ajax.reload(null, false);
|
||||
} else {
|
||||
console.warn('endorsementTable not ready');
|
||||
}
|
||||
}, ms);
|
||||
}
|
||||
}
|
||||
@ -421,7 +428,7 @@
|
||||
|
||||
if (ticketsTable.length) {
|
||||
nhanceListDataTableBeforeInit();
|
||||
var table = ticketsTable.DataTable(nhanceMergeListDataTableOptions({
|
||||
endorsementTable = ticketsTable.DataTable(nhanceMergeListDataTableOptions({
|
||||
autoWidth: false,
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
@ -441,6 +448,7 @@
|
||||
return $.extend({}, d, endorsementTableFilters);
|
||||
},
|
||||
dataSrc: function(json) {
|
||||
console.log('cache_expires_in_ms:', json.cache_expires_in_ms);
|
||||
scheduleEndorsementAutoReload(json.cache_expires_in_ms || 300000);
|
||||
return json.data;
|
||||
}
|
||||
@ -524,7 +532,7 @@
|
||||
ordering: false,
|
||||
}));
|
||||
nhanceListDataTableAfterInit();
|
||||
nhanceListDataTableBindAdjust(table);
|
||||
nhanceListDataTableBindAdjust(endorsementTable);
|
||||
} else {
|
||||
console.error("Table not found.");
|
||||
}
|
||||
|
||||
@ -641,14 +641,21 @@ var inceptionTableFilters = <?= json_encode($inception_filters ?? []) ?>;
|
||||
var inceptionListDataTableUrl = '<?= base_url('policy_tranction/inception/list/datatable') ?>';
|
||||
var inceptionClearCacheUrl = '<?= base_url('policy_tranction/inception/list/clear-cache') ?>';
|
||||
var inceptionAutoReloadTimer = null;
|
||||
var inceptionTable = null;
|
||||
|
||||
function scheduleInceptionAutoReload(ms) {
|
||||
if (inceptionAutoReloadTimer) {
|
||||
clearTimeout(inceptionAutoReloadTimer);
|
||||
}
|
||||
if (ms > 0) {
|
||||
console.log('Inception auto-reload scheduled in', ms, 'ms (~', Math.round(ms / 1000), 's)');
|
||||
inceptionAutoReloadTimer = setTimeout(function() {
|
||||
window.location.reload();
|
||||
console.log('Inception auto-reload fired — refreshing table only');
|
||||
if (inceptionTable) {
|
||||
inceptionTable.ajax.reload(null, false);
|
||||
} else {
|
||||
console.warn('inceptionTable not ready');
|
||||
}
|
||||
}, ms);
|
||||
}
|
||||
}
|
||||
@ -717,7 +724,7 @@ $(document).ready(function() {
|
||||
|
||||
if (ticketsTable.length) {
|
||||
nhanceListDataTableBeforeInit();
|
||||
var inceptionTable = ticketsTable.DataTable(nhanceMergeListDataTableOptions({
|
||||
inceptionTable = ticketsTable.DataTable(nhanceMergeListDataTableOptions({
|
||||
autoWidth: false,
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
@ -737,6 +744,7 @@ $(document).ready(function() {
|
||||
return $.extend({}, d, inceptionTableFilters);
|
||||
},
|
||||
dataSrc: function(json) {
|
||||
console.log('cache_expires_in_ms:', json.cache_expires_in_ms);
|
||||
scheduleInceptionAutoReload(json.cache_expires_in_ms || 300000);
|
||||
return json.data;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user