Periodically refreshing the table view without reloading the page
Posted: 2018-10-14 14:51
An AppGini user sent me an interesting question, and I wanted to share the answer here. Here is his question:
Replace tablename in the above code with the actual name of the table, and optionally change 10000 to the number of milliseconds between reloads -- or leave it to reload the table every 10 seconds. This will update the table with any new records every 10 seconds without reloading the whole page or flickering the screen.
A very simple solution is to use jQuery .load() method ... Add the following code to the hooks/tablename-tv.js file (where tablename is the name of the concerned table -- create the file if it doesn't already exist in hooks):I need to refresh the table view, but without blinking, as currently setInterval is very anoying. Is there any way to AJAX load the table view, or do you have any suggestion (Use case : the table view is used on a big screen, there is 5 tablets who "post" to the big screen. so everytime somebody insert a new record it is visible on the big screen.)
Code: Select all
$j(function(){
setInterval(function(){
$j('table').parent().load('tablename_view.php table');
}, 10000);
})