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.

Notification Data passed into notification<br />

onCurrentRowChanged Object with the following properties:<br />

oldRowID: The ds_RowID of the last current row.<br />

newRowID: The ds_RowID of the current row.<br />

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

removeObserver().<br />

var dsPhotos = new <strong>Spry</strong>.Data.XMLDataSet("/photos.php?galleryid=2000",<br />

"/gallery/photos/photo");<br />

...<br />

dsPhotos.removeObserver(myObserver);<br />

Functions as observers<br />

Functions can also be registered as observers. The main difference between object and function observers is that an<br />

object is only notified for the notification methods it defines, whereas a function observer is called for every type of<br />

event notification.<br />

var dsPhotos = new <strong>Spry</strong>.Data.XMLDataSet("/photos.php?galleryid=2000",<br />

"/gallery/photos/photo");<br />

...<br />

function myObserverFunc(notificationType, dataSet, data)<br />

{<br />

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

alert("onDataChanged called!";<br />

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

alert("onPostSort called!";<br />

};<br />

dsPhotos.addObserver(myObserverFunc);<br />

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

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

name of the notification. The second argument is the notifier, which in this case is the data set, and the third<br />

argument is the data for 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 />

var dsPhotos = new <strong>Spry</strong>.Data.XMLDataSet("/photos.php?galleryid=2000",<br />

"/gallery/photos/photo");<br />

...<br />

dsPhotos.removeObserver(myObserverFunc);<br />

Working with dynamic regions<br />

SPRY<br />

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

Looping constructs<br />

Dynamic regions currently support two looping constructs. One allows you to repeat an element and all of its content<br />

for each row in a given data set (spry:repeat), and another allows you to repeat all of the children of a given<br />

element for each row in a given data set (spry:repeatchildren).<br />

128

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

Saved successfully!

Ooh no, something went wrong!