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 Description<br />

onPreSort The data in the data set is about to be sorted.<br />

onPostSort The data in the data set has been sorted.<br />

onCurrentRowChanged The data set's notion of the current row has changed.<br />

Objects as observers<br />

To receive notifications, an object must define a method for each notification it is interested in receiving, and then<br />

register itself as an observer on the data set. For example, an object interested in onDataChanged notifications must<br />

define an onDataChanged() method and then call addObserver().<br />

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

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

...<br />

var myObserver = new Object;<br />

myObserver.onDataChanged = function(dataSet, data)<br />

{<br />

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

};<br />

dsPhotos.addObserver(myObserver);<br />

The first argument for each notification method is the object that is sending the notification. For data set observers,<br />

this is always the dataSet object. The second argument is either undefined, or an object that depends on the type<br />

of notification.<br />

Notification Data passed into notification<br />

onPreLoad undefined<br />

onPostLoad undefined<br />

onLoadError The <strong>Spry</strong>.Utils.loadURL.Request object that was used when making<br />

the request<br />

onDataChanged undefined<br />

onPreSort Object with the following properties:<br />

oldSortColumns: An array of columns used during the last sort.<br />

oldSortOrder: The sort order used during the last sort.<br />

newSortColumns: The array of columns about to be used for the<br />

sort.<br />

newSortOrder: The sort order about to be used for the sort.<br />

onPostSort Object with the following properties:<br />

oldSortColumns: An array of the columns used in the previous sort.<br />

oldSortOrder: The sort order used during the previous sort.<br />

newSortColumns: The array of columns used for the sort.<br />

newSortOrder: The sort order used for the sort.<br />

SPRY<br />

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

127

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

Saved successfully!

Ooh no, something went wrong!