Spry User Guide - Support - Adobe
Spry User Guide - Support - Adobe
Spry User Guide - Support - Adobe
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
5 You can make the dynamic region more interactive by defining click events that allow users to sort data. For<br />
instructions, see “Let users sort data” on page 115.<br />
Sample code: <strong>Spry</strong> data set and dynamic region<br />
The following sample code creates a <strong>Spry</strong> data set and dynamic region to display a list of menu specials in an HTML<br />
table.<br />
<br />
...<br />
<br />
<br />
<br />
var dsSpecials = new <strong>Spry</strong>.Data.XMLDataSet("data/cafetownsend.xml",<br />
"specials/menu_item");<br />
<br />
...<br />
<br />
<br />
...<br />
<br />
<br />
<br />
Item<br />
Description<br />
Price<br />
<br />
<br />
{item}<br />
{description}<br />
{price}<br />
<br />
<br />
<br />
...<br />
<br />
Let users sort data<br />
You can spry:sort attributes to your dynamic region that allow users to interact with the data. This section uses the<br />
table code from “Create a <strong>Spry</strong> dynamic region and display data” on page 113 as an example.<br />
1 Locate the place in the code where you want to add the spry:sort attribute or attributes. In this example, the<br />
attributes are added to two column headers in a table that displays the XML data.<br />
2 Add a spry:sort attribute to the appropriate column header tags, using the following form:<br />
spry:sort="columnName"<br />
The value defined in the spry:sort attribute tells the data set which column to use when sorting the data<br />
For example, adding the following spry:sort attributes (in bold) to column header tags sorts the dynamic region data<br />
according to the specified value whenever the user clicks a column header on the page.<br />
SPRY<br />
<strong>User</strong> <strong>Guide</strong><br />
115