loadjs.ready("load", function() {
// check for updates every 3 seconds
function refreshTable() {
tableRefresh = setInterval(function() {
$('table.ew-table > tbody').load(location.href + ' table.ew-table > tbody tr', function() {
$(this).find('tr:even').removeClass('ew-table-alt-row').addClass('ew-table-row');
$(this).find('tr:odd').removeClass('ew-table-row').addClass('ew-table-alt-row');
});
}, 3000); // Change this value as appropriate to set the refresh period ... 1000 = 1 second
}
refreshTable();
});
But nothing happend, the table on view page won’t refresh.
Is there something wrong with my code? (version 2020)
I’m trying to change my code from this :
$(‘table.ew-table > tbody’).load(location.href + ’ table.ew-table > tbody tr’to this :
$(‘table.ew-view-table > tbody’).load(location.href + ’ table.ew-view-table > tbody tr’So, this is the complete code :
function refreshTable() {
tableRefresh = setInterval(function() {
$(‘table.ew-view-table > tbody’).load(location.href + ’ table.ew-view-table > tbody tr’, function() {
$(this).find(‘tr:even’).removeClass(‘ew-table-alt-row’).addClass(‘ew-table-row’);
$(this).find(‘tr:odd’).removeClass(‘ew-table-row’).addClass(‘ew-table-alt-row’);
});
}, 3000); // Change this value as appropriate to set the refresh period … 1000 = 1 second
refreshTable();
});The time interval work, but my table has gone and left blank view.
Any advice I will thank you