04.02.2013 Views

Spry User Guide - Support - Adobe

Spry User Guide - Support - Adobe

Spry User Guide - Support - Adobe

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

...<br />

function myRegionCallback(notificationState, notifier, data)<br />

{<br />

if (notificationType == "onPreUpdate")<br />

alert(regionID + " is starting an update!");<br />

else if (notificationType == "onPostUpdate")<br />

alert(regionID + " is done updating!");<br />

}<br />

...<br />

// Call addObserver() to register your function as an observer.<br />

<strong>Spry</strong>.Data.Region.addObserver("employeeListRegion", MyRegionCallback);<br />

...<br />

// You can unregister your callback function so it stops recieving notifications<br />

// with a call to removeObserver().<br />

<strong>Spry</strong>.Data.Region.removeObserver("employeeListRegion", MyRegionCallback);<br />

...<br />

<br />

...<br />

<br />

...<br />

<br />

A function observer is registered with the same call to addObserver().<br />

When the function is called, the first argument passed into it is the notification type. This is a string that is the name<br />

of the notification. The second argument is the notifier, which in this case is not the region object. The third<br />

argument is a data object that has a regionID property that tells us what region triggered the notification.<br />

To stop a function observer from receiving notifications, it must be removed from the list of observers with a call to<br />

removeObserver().<br />

The following table describes the current set of supported notifications.<br />

Region notification type Description<br />

onLoadingData One or more of the region's bound data sets is loading its data.<br />

onPreUpdate All of the region's bound data sets have loaded successfully. The<br />

region is about to regenerate its code.<br />

onPostUpdate The region has regenerated its code and inserted it into the document.<br />

onError An error occurred while loading data.<br />

Data reference options<br />

Each data set has a set of built-in data references that can be useful during the dynamic region regeneration process.<br />

Like data set column names, these built-in data references must be prefixed with the name of the data set if the<br />

dynamic region is bound to more than one data set.<br />

For example, to display the row number of the current row of the data set when the region regenerates, add the<br />

ds_RowNumber data reference to the dynamic region, as follows:<br />

SPRY<br />

<strong>User</strong> <strong>Guide</strong><br />

135

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!