04.02.2013 Views

Spry User Guide - Support - Adobe

Spry User Guide - Support - Adobe

Spry User Guide - Support - Adobe

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

In the example code, spry:region is used for the detail region instead of spry:detailregion. The difference<br />

between a spry:region and a spry:detailregion is that the spry:detailregion specifically listens for<br />

CurrentRowChange notifications (in addition to DataChanged notifications) from the data set, and updates itself<br />

when it receives one. Because the current row of the dsIngredients datasetneverchanges(it’sthecurrentrowof<br />

the dsSpecials data set that changes), a spry:detailregion attribute is not needed. In this case, the spry:region<br />

attribute, which defines a region that only listens for DataChanged notifications, suffices.<br />

About progressive enhancement and data set accessibility<br />

Progressive enhancement writes code for a document for the lowest common denominator of browser functionality<br />

and then enhances the presentation and behavior of the page, using CSS, JavaScript, Flash, Java, and SVG code, and<br />

so on. Pages created with this approach provide an enhanced experience in modern browsers, but the data is still<br />

accessible and the page still functional in the absence of these technologies.<br />

All of the <strong>Spry</strong> examples in this document up to this point have dealt with using JavaScript to dynamically load XML<br />

data and generate regions of the document. You can also use <strong>Spry</strong> in a progressive enhancement manner using the<br />

Hijax methodology (see http://domscripting.com/blog/display/41). This progressive enhancement methodology<br />

uses JavaScript to unobtrusively attach event handlers to items on the page, such as links to catch user events (for<br />

example, clicks). Progressive enhancement also lets you replace parts of your document with code fragments that are<br />

delivered asynchronously from the server to avoid having to load an entire page.<br />

Asatrivialexampleofusing<strong>Spry</strong>withthismethodology,youcouldstartwithanHTMLpagefilledwithstaticdata<br />

and links:<br />

<br />

<br />

<br />

<br />

Hijax Demo - Notes 1<br />

<br />

<br />

Note 1<br />

Note 2<br />

Note 3<br />

<br />

This is some static content for note 1.<br />

<br />

<br />

<br />

To progressively enhance this page with <strong>Spry</strong>, so that you don't have to load an entirely new page when you click the<br />

links, you first use XML to make sure that the page fragments of each page that the links refer to are accessible. The<br />

following example is one way to externalize the static data:<br />

<br />

<br />

This is some dynamic content for note 1.]]><br />

This is some dynamic content for note 2.]]><br />

This is some dynamic content for note 3.]]><br />

<br />

You can then apply <strong>Spry</strong> to the HTML page in the following manner:<br />

SPRY<br />

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

109

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

Saved successfully!

Ooh no, something went wrong!