I have a Report region that I am refreshing via jQuery. I have the following code with the region footer to set up the refresh process:
<script type="text/javascript">
var refreshId = setInterval(function(){ apex.jQuery('##REGION_ID#').trigger('apexrefresh');
}, 5000);
</script>
This works correctly, and the report data is refreshed every 5 seconds. However, the region also contains an Item, whose source value is determined via a SQL Query. I want this value to refresh every time the report region data refreshes too, but the triggered refresh doesn’t do this.
Looking closer, it seems the report region div does not contain the Item HTML, so the part of the DOM that gets swapped out during the refresh does not contain the item. The item appears inside a sibling table node called apex_layout_#REGION_ID#:
<div class="rc-content-main">
<table id="apex_layout_7017903473906209" class="formlayout" border="0" summary="">
<div id="report_7017903473906209_catch">
<script type="text/javascript">
</div>
I’ve tried doing an additional .trigger() call passing in the Item’s ID instead of #REGION_ID# but confusingly this does the exact same refresh of the report data. I’ve also tried setting up a Dynamic Action to fire on “After Refresh” on the region that will refresh the Item, but this does something strange too – it fires repeated AJAX calls with no delay and doesn’t change the item value.
Any help appreciated.
You can’t refresh an item using the apexrefresh event. You are on the right track with the dynamic action: you will need to ‘manually’ retrieve a new value.
Could you elaborate on how you have set up your “after refresh”-triggered dynamic action for your item? Does it have a true action of “set value” with “sql statement”? Did you inspect the ajax calls? Any errors? Do the calls keep repeating? Also, check the session state (access through the “session” button on the developer bar on the bottom) of the items, and see if the value there has changed.