Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to Wait for trigger('apexrefresh') to Complete Before Proceeding

Joseph UpshawApr 2 2013 — edited Apr 9 2013
All,

I am sure this is a silly problem but, I've been stuck on this for a while. I need to refresh a report region on demand and then, examine the content to determine what should be done next. The problem is that the call to trigger('apexrefresh') appears to be asynchronous and I need to find a way to make it block until the refresh has completed. In other words, the code following the refresh just continues on without waiting.

For example:
function popupProfileCopyDialog(targetProductProfileID)
{	var mismatchCnt	= 0;

	setTargetProductProfileID( targetProductProfileID );
	$('section#PROFILE_TERM_PROPERTY_INSTANCES_RR').trigger('apexrefresh');
	
	mismatchCnt = $('section#PROFILE_TERM_PROPERTY_INSTANCES_RR').find( 'span.profilePropertyMismatch').length;
	
	alert( mismatchCnt );	
}
In the case of the above code, if a span occurs with a class of profilePropertyMismatch, I'd want to incement this count. However, the count is being performed immediately, i.e. not after the refresh. That is, run it the first time, get 0 for the mismatchCnt (because the region is still empty). Run it again, get 1 (one row with a span that has this class). Change to another row, refresh on one with 0 profilePropertyMismatch spans, still get 1 (from the previous refresh). Run again, get 0. etc.

How can I make the code wait for the call to $('section#PROFILE_TERM_PROPERTY_INSTANCES_RR').trigger('apexrefresh'); to complete before proceeding to the next line?

Thanks,

-Joe
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 7 2013
Added on Apr 2 2013
6 comments
2,162 views