| By Paul Gubbay | Article Rating: |
|
| May 19, 2007 02:45 PM EDT | Reads: |
19,594 |
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,594
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.
- Adobe’s Aiming ColdFusion at Multiple Clouds
- Cloud Computing Journal: Adobe to Deliver ColdFusion in the Cloud
- Adobe May Cooperate with Apple to Transplant Flash Player to iPhone
- Adobe Flex Developer Earns $100K in New York City
- Adobe LiveCycle Enterprise Suite 2 for Cloud Computing
- Adobe Betas Target RIAs and Cloud Computing
- Adobe Cans Another 9% of its Workforce
- Moyea DVD4Web Converter V2.0 Converts DVD to FLV Fast and Synchronously with Watermarks
- Adobe & Salesforce Cut Cloud Deal
- Adobe Fiddles with its Web Apps
- Hosting.com Launches ColdFusion 9 in the Cloud
- The Real Time Infrastructure Ultimatum
- Adobe’s Aiming ColdFusion at Multiple Clouds
- Eval JavaScript in a Global Context
- Fig Leaf Software to Exhibit at Government IT Conference & Expo
- Cloud Computing Journal: Adobe to Deliver ColdFusion in the Cloud
- Is Microsoft as Free as Open Source?
- Adobe Reader Sued
- The Planet Named “Bronze Sponsor” of Cloud Computing Expo
- Microsoft Expression Web Has Got Game
- Adobe May Cooperate with Apple to Transplant Flash Player to iPhone
- Adobe Flex Developer Earns $100K in New York City
- Bruce Chizen Joins Voyager Capital as Venture Partner
- My Top Seven Wishes From Adobe MAX 2009
- The Next Programming Models, RIAs and Composite Applications
- Where Are RIA Technologies Headed in 2008?
- Constructing an Application with Flash Forms from the Ground Up
- AJAX World RIA Conference & Expo Kicks Off in New York City
- CFEclipse: The Developer's IDE, Eclipse For ColdFusion
- Personal Branding Checklist
- Adobe Flex 2: Advanced DataGrid
- Has the Technology Bounceback Begun?
- Building a Zip Code Proximity Search with ColdFusion
- i-Technology Viewpoint: We Need Not More Frameworks, But Better Programmers
- The Asynchronous CFML Gateway
- Web Services Using ColdFusion and Apache CXF





















