Reputation: 675
I have a code for auto-updating the region, this iodine is immersed in the panel "Execute when Page Loads":
setInterval ( "jQuery ('#report_modified'). trigger ('apexrefresh');" , '10000' );
this code works. But I want to make sure that I can disable this automatic update from the page. That is, I want to uncheck and stop updating.Can anyone help me with this ?? I tried so, but it doesn't work when changing the state of a variable. And I don't know what to do
if($v('P91_AUTOUPDT') == 'true'){
setInterval ( "jQuery ('#report_modified'). trigger ('apexrefresh');" ,'1000' );
};
Upvotes: 0
Views: 406
Reputation: 18630
Best place to start is the docs. setInterval takes a callback function and an interval. So eval the condition in the function and you're good to go. Change the code to:
setInterval ( function(){
if (apex.item( "P91_AUTOUPDT" ).getValue() === 'true') {
$('#report_modified').trigger('apexrefresh');
}
} , '10000' );
This works fine for me.
Upvotes: 1