Apex 5.1 Autorefresh Region With Variable Refresh Time
P998_SESS_INFO is my classic report P998_REFRESH is hidden item P998_REFRESH_RATE is LOV with static values of STATIC: 10 Sekunden;10000, 20 Sekunden;20000, 30 Sekunden;30000
Solution 1:
Two problems:
1 - this code do not start the event change on item. (this change the value on the page, but not trigger the dynamic action). instead of this
$x('P998_REFRESH').value = $x('P998_REFRESH_RATE').value;
try this
$s('P998_REFRESH', $x('P998_REFRESH_RATE').value);
2 - you need to clear the previous setInterval value. it's not enough set new interval. So you need to store in a variable every call to setInterval
var sintervalid = setInterval("jQuery('#P998_SESS_INFO').trigger('apexrefresh');", interval);
and to reset
clearInterval(sintervalid);
sintervalid = setInterval("jQuery('#P998_SESS_INFO').trigger('apexrefresh');", interval);
If I were to do something like this, I would try it like this:
1 - I create one global variable in my html header, setting the default value:
<scripttype="text/javascript">var sIntervalId = setInterval(function(){
jQuery('#P998_SESS_INFO').trigger('apexrefresh');
}, 30000);
</script>
2 - I create a dynamic action when change my item that store the interval
dynamic action: change item P998_REFRESH_RATE
true action: execute javascript code:
clearInterval(sIntervalId);
sIntervalId = setInterval(function(){
jQuery('#P998_SESS_INFO').trigger('apexrefresh');
}, $x('P998_REFRESH_RATE').value);
***I did not test this, but it would be more or less that way.
Post a Comment for "Apex 5.1 Autorefresh Region With Variable Refresh Time"