Auto refresh for grids

Hi,

does anyone know how to set the autorefresh value for a grid (or any other application) at runtime per macro or code? My idea is to let the user select from a dropdown the seconds for autorefresh.

Thanks for any suggestion

image

Hi @mc73 you can create a function in JS like this

setTimeout(function(){
window.location.reload();
}, <?php echo $time_var; ?> );

Thanks for this approach! I’ll try it out

Hi alvagar,
Thanks for this hint. This is the setting I know, but unfortunately this solution is a static value that cannot be changed at runtime. My purpose is to make this configurable by user within the grid.
Regards

I would try a global variable [timevartest] in that box with static values then assign the values dynamically. NOTE: I have not tried it but hopefully it works.

Hi,
this was my first thought, too. But, unfortunately the field is a numeric only field with an additional spinner to increase and decrease the values. No letters or special characters as the brackets are allowed in there. So It must be a code based solution. I hoped to find some macro but as suggested, most probably the only solution will be a JS based. As soon as I find the time to implement it, I’ll post it here…
Regards

the grid refresh sets a js onload event on body:

onload="javascript:setTimeout(function(){clear_reload = nm_gp_submit_ajax ('igual', 'reload');},20000);"

so implement your timing with setTimoeout and call nm_gp_submit_ajax (‘igual’, ‘reload’); to reload the grid.