| By Paul Gubbay | Article Rating: |
|
| May 19, 2007 02:45 PM EDT | Reads: |
19,578 |
If we take a look at our example we can see that the Products table and Product image are contained within Spry Regions that are bound to a Spry XML Data Set. When the data changes within the Data Set, both regions automatically update themselves to reflect the new data.
Loading Data
The Spry Data Set is responsible for loading and processing data behind the scenes (see Figure 4).
XML is frequently used to transfer data from the server to the client.
The XML Data Set in Spry can be used to retrieve this data through the
browser via the XMLHTTPRequest object. The XML can be contained in a
file or returned from a server-side function call (e.g., PHP,
ColdFusion, ASP).
Once the XML data is retrieved it's flattened into a standard record/field format to make it easier for users to bind the data to Spry Regions in the Web page. Spry uses XPath, a W3C standard for describing a set of nodes in XML, to identify the nodes(s) that represent a record of data.
In Figure 5 you can see a sample XML file (products.xml) that represents the products in our table. Using XPath (products/product) we identify the node(s) in the XML file that represent the records of data for our Data Set. Finally, we can see the records and fields in the Spry Data Set once the conversion is complete.
Data Set Declaration
Spry Data Sets are added to your page in two steps. First, you must include the appropriate JavaScript libraries:
Second, create an instance of the Data Set by passing in the location to the XML data and defining the repeating node that represents a record of the data. This code is added to the head of the document.
- Variable reference: Name of the Data Set. Referenced through data bindings or JavaScript.
- Object Instance: Creates an instance of the Data Set object using the "new" keyword.
- XML Data: Pointer to the XML file or server-side function that returns XML.
- XPath: Pointer to the node in the XML file that represents a record of the data.
Data is displayed on the Web page using Spry Regions that are loaded with live data when the Web page is displayed in the browser. Creating the bindings from the Data Set to the Spry Regions is easily accomplished by attaching Spry attributes to your standard HTML tags.
In the following example we can see how the Spry Region for the Products table is built:
- Spry Region Declaration: Defines an HTML element as a Spry region.
- Data Set Binding: Binds a Spry Region to a Data Set.
- Spry Attributes: Specialized attributes that provide additional functionality such as sorting.
- Spry Data Bindings: Bindings to fields located in the Data Set.
- Repeat Region Declaration: Repeats a Spry Region once for each record in the Data Set.
Published May 19, 2007 Reads 19,578
Copyright © 2007 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Paul Gubbay
Paul Gubbay is a director of engineering at Macromedia. Previously, Paul held the role of CEO at CyberSage Software, where he spent several years building the vision and infrastructure of the company. Under Paul's guidance, CyberSage focused on emerging technologies such as XML, Java, and Macromedia Flash to deliver leading edge product offerings.
- Kindle 2 vs Nook
- Cloud Computing on Gartner's Top 10 List and SYS-CON Events' 2010 Calendar
- Confessions of a Ulitzer Addict
- IBM Hardware Chief, Intel VC Exec Arrested in Insider Trading Scam
- Tactical Cloud Computing Panel at 1st Annual GovIT Expo
- Ulitzer.com Named Exclusive "New Media" Sponsor of Cloud Computing Conference & Expo
- Moving Your RIA Apps into the Cloud: Seven Challenges
- Adobe’s Aiming ColdFusion at Multiple Clouds
- Windows 7 – Microsoft’s First Step to the Cloud
- Ulitzer Provides a Powerful Social Journalism Platform
- Jill Tummler Singer, Deputy CIO of CIA, Keynotes at GovIT Expo
- Open Source Mobile Cloud Sync and Push Email
- Kindle 2 vs Nook
- The Difference Between Web Hosting and Cloud Computing
- Cloud Computing on Gartner's Top 10 List and SYS-CON Events' 2010 Calendar
- Ajax in RichFaces 3.3, JSF 2 and RichFaces 4
- Confessions of a Ulitzer Addict
- IBM Hardware Chief, Intel VC Exec Arrested in Insider Trading Scam
- My Thoughts on Ulitzer
- Tactical Cloud Computing Panel at 1st Annual GovIT Expo
- Ulitzer.com Named Exclusive "New Media" Sponsor of Cloud Computing Conference & Expo
- US Post Office Hops a Ride on NetSuite’s Cloud
- Moving Your RIA Apps into the Cloud: Seven Challenges
- Adobe’s Aiming ColdFusion at Multiple Clouds
- Building a Drag-and-Drop Shopping Cart with AJAX
- What Is AJAX?
- Google Maps! AJAX-Style Web Development Using ASP.NET
- Flashback to January 2006: Exclusive SYS-CON.TV Interviews on "OpenAjax Alliance" Announcement
- AJAXWorld Conference & Expo to Take Place October 2-4, 2006, at the Santa Clara Convention Center, California
- AJAX Sponsor Webcasts Are Now Available at AJAXWorld Website
- How and Why AJAX, Not Java, Became the Favored Technology for Rich Internet Applications
- "Real-World AJAX" One-Day Seminar Arrives in Silicon Valley
- AJAXWorld University Announces AJAX Developer Bootcamp
- AJAX Support In JadeLiquid WebRenderer v3.1
- Where Are RIA Technologies Headed in 2008?
- Struts Validations Framework Using AJAX


































