Auto refresh page

i want to get page auto-refresh(list page) with this code (JAVA):

can i do it ? or where should i put this code in? if not pls. told me how to do that regards..................again

Put it under “Startup Script” in “Client Scripts” section. Google for “jquery auto refresh page”.

it’s work well.

I am using the following code:

<? php $url1 = $_SERVER['REQUEST_URI']; header("Refresh: 60; URL = $url1"); ?>I put it there: client scripts / Global / Table-Specific / Startup Script (in PHP reportmaker)

This works well, but the whole page now refreshes every minute. It would be better if only the content refreshed without the menu bar.thank you very much in advance

Your code tells the browser to refresh the whole page. If you want to do Ajax, you need to write more code, i.e. get the content by Ajax, write a success handler function to extract the content you need and then replace by jQuery. Read:
https://api.jquery.com/jquery.get/
https://api.jquery.com/replaceWith/

I’ve been playing with this concept as I have a couple of list pages in my current project that would benefit from ajax row refreshes.Rather than using $.get() as suggested, I found that it was simpler to use “.load()” via this little code snippet in the list page Startup event: (v2020)loadjs.ready(“load”, function() {
// check for updates every 15 seconds
function refreshTable() {
tableRefresh = setInterval(function() {
$(‘#tbl_mytablelist > tbody’).load(window.location.href + ’ #tbl_mytablelist > tbody tr’);
}, 10000);
}

refreshTable();

});The only slight annoyance is that the “ew-table-row” / “ew-table-alt-row” classes seem to get dropped / lost when the rows are replaced in the target element.Can anyone shed some light on why it’s happening?

Adam wrote:
Rather than using $.get() as suggested, I found that it was simpler to use “.load()” via this little code snippet in the list page Startup eventIt is a clever approach.You may try to add a callback to .load() and call:$(“.ew-table”).each(ew.setupTable);

I finally found an approach that works (and also made it more “drop-in” code):Dropping the following snippet into the Client Scripts > Table Specific > List Page > Startup Script event will automatically refresh the table rows based every xx seconds (just specify the refresh period):

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');

                            });

            }, 10000); // Change this value as appropriate to set the refresh period ... 1000 = 1 second

}refreshTable();

Adam wrote:
I finally found an approach that works (and also made it more “drop-in”
code):Dropping the following snippet into the Client Scripts > Table Specific > ListThis is nice work.
However, problem remains when using PreviewRow → table of main list page gets refreshed, but then preview-row is closed and on-click event on ‘preview-row-btn’ dissapear and cannot be reopen.Ideally, I’m trying to achieve that preview-row stays open, but new values of main list page gets loaded.
How to solve this?
:slight_smile:

The most up-to-date version is here: viewtopic.php?f=18&t=45517There are no issues with previews that I’m aware of - the default behaviour is to suspend refreshing if a preview is open, but even with that safety option disabled, you can still reopen the preview after the refresh has completed.If you want to extend the code to retain open previews then feel free to do so and share the enhancement.

Thanks a lot, this works perfectly. :slight_smile:

Please help me. The code below is working when I used
table.

$(‘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’);

But it does not work on custom template since i do not used table

\ \
{{{value lnLoanTypesId}}}
{{{value lnLoanMemberId}}}
\ \
\ \ \
{{{value lnLoanApplicationDate}}}
{{{caption lnLoanApplicationDate}}}
{{{value lnLoanAmount}}}
{{{caption lnLoanAmount}}}
{{{value lnLoanDeductions}}}
{{{caption lnLoanDeductions}}}
{{{value lnLoanNetLoan}}}
{{{caption lnLoanNetLoan}}}
\ \
\ \ \
\ \ \

wincode2008 wrote:

$(‘table.ew-table > tbody’).load(location.href + ’ table.ew-table > tbody tr’,> function() {…})

There is no ‘table.ew-table’ in your Custom Template.

So what will I do? Since i do not used table, what can i replace to this code

$(‘table.ew-table > tbody’).load(location.href + ’ table.ew-table > tbody tr’,> function() {…})

i used pure div not table to display the record. Is there a way to solved this?

Please help me. The code below is working when I used
table.

$(‘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’);

But it does not work on custom template since i do not used table

\ \
{{{value lnLoanTypesId}}}
{{{value lnLoanMemberId}}}
\ \
\ \ \
{{{value lnLoanApplicationDate}}}
{{{caption lnLoanApplicationDate}}}
{{{value lnLoanAmount}}}
{{{caption lnLoanAmount}}}
{{{value lnLoanDeductions}}}
{{{caption lnLoanDeductions}}}
{{{value lnLoanNetLoan}}}
{{{caption lnLoanNetLoan}}}