Adobe COLDFUSION 9 Manual page 880

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Requesting and Presenting Information
• Spry data sets use a CFC function as the data source. To do this, you simply specify the URL of the CFC in the
Spry.Data.XMLDataSet function, just as you would invoke any remote CFC method using a URL. Specify the
method name with a method URL parameter, and pass data to the function in additional URL parameters, as in the
following example:
Spry.Data.XMLDataSet("MyAppMgr.cfc?method=getFilter&filter=scores",
"filters/filter");
• The cfsprydataset tag dynamically creates and updates Spry XML or JSON data sets based on ColdFusion form data.
Spry dynamic regions and other elements then use this data to control their display.
The following example shows a
the getData.getProductDetails function and passing it the value of the selected name in a
set updates each time the
<cfsprydataset
name="dsProducts"
type="xml"
bind="CFC:getData.getProductDetails(prodname={myform:mygrid.name})"
xpath="products/product"
options="{method: 'POST'}"
onBindError="errorHandler">
ColdFusion includes the complete Spry 1.5 framework release in web_root/CFIDE/scripts/ajax/spry directory. For
more information about Spry framework, see www.adobe.com/go/learn_spry_framework_en. For more information,
see the cfsprydataset tag in the CFML Reference.
Spry data set example
This example has the following behavior:
It uses a CFC function directly to populate a Spry XML data set, from an XML file.
1
It displays information from the Spry data in a Spry dynamic region list box.
2
3
It uses the selected item in the Spry data set to control the contents of a
calls a CFC and passes it a parameter bound to the selected item in the Spry XML data set.
4
It creates a second Spry XML data set by using a
control and calls a CFC function.
It displays information from the second Spry data set in a second Spry dynamic region.
5
The example lets a user select the genre of books to display: all books, fiction, or nonfiction from a Spry list box
populated from the XML file. The selected genre determines the information displayed by a
input control shows the selected genre. The selected item in the
displayed in a second Spry dynamic region.
The application consists of the following files:
• A roundtrip.cfm page with the display controls and related logic
• A GridDataManager.cfc file with two functions:
• A getFilter function that gets the XML for the spry data set
• A getData function that gets the contents of the cfgrid control
• A getProduct function that gets detailed information on the selected book
• A Filters.xml file with the XML data for the spry data set
tag that creates a Spry XML data set named dsProducts by calling
cfsprydataset
value changes.
name
cfsprydataset
Last updated 8/5/2010
cfgrid
control. The
cfgrid
tag that binds to the selected item in the
cfgrid
control determines the information that is
cfgrid
875
control. The data
bind expression
cfgrid
cfgrid
control, and a text

Advertisement

Table of Contents
loading

Table of Contents