I am trying to use spry to page forward and backward through data
returned through a query. I have been looking at Bruce Phillips blog
about this and I can't get the thing to work. Always get the SPRY
"spry:region or sprydetailregion attribute has no data set!" error. The
customer will need to supply search parameters which is then submitted
to this CFC.
<CFFUNCTION name="GetEmployerResults" returntype="xml" output="false">
<CFARGUMENT name="EmployerName" default="" />
<cfset var EmployerQry = "">
<cfset var EmployerXML = "">
<cfset var parsedEmployerXML = "">
<CFQUERY datasource="#request.dsource#" name="EmployerQry">
SELECT rtrim(FirstName) as FirstName, rtrim(LastName) LastName,
rtrim(EmailAddress) as EmailAddress
FROM AMP_Employers
WHERE EmployerID > 0
</CFQUERY>
<cfset toXML = createObject("component", "toXML")>
<cfset EmployerXML = toXML.queryToXML(EmployerQry, "dataset", "row")>
<cfset parsedEmployerXML = xmlParse(EmployerXML) >
<CFFILE ACTION="write" FILE="Employers.xml"
OUTPUT="#ToString(parsedEmployerXML)#" nameconflict="overwrite">
//Only used for testing to see if the XML file is produced correctly.
<cfcontent type="application/xml; charset=UTF-8">
<CFRETURN parsedEmployerXML />
</CFFUNCTION>
My result page uses the following spry code, I know the
#request.EmployerResults# is the problem, but I need to know how to
allow a customer to supply search parameters and then pass the results
of the query to the result page. I do not want to have to create an
actual xml file and store it in a directory. Which will work perfectly
if I change #request.EmployerResults# to "../Employers.xml"
<script type="text/javascript">
//create a basic Spry DataSet
var dsEmployers = new Spry.Data.XMLDataSet("#request.EmployerResults#",
"dataset/row");
//create a page-enabled view of the Spry DataSet
var pvEmployers = new Spry.Data.PagedView(dsEmployers, { pageSize: 12
});
</script>
Below is the XML file that is created when I write the file.
<?xml version="1.0" encoding="UTF-8"?>
<dataset>
<row>
<EMAILADDRESS>[EMAIL PROTECTED]</EMAILADDRESS>
<FIRSTNAME>Test 1 First Name</FIRSTNAME>
<LASTNAME>Test 1 Last Name</LASTNAME>
</row>
<row>
<EMAILADDRESS>[EMAIL PROTECTED]</EMAILADDRESS>
<FIRSTNAME>Another Test First Name</FIRSTNAME>
<LASTNAME>Another Test Last Name</LASTNAME>
</row>
</dataset>
I am also using Mach-II and here is where it is called.
<!-- Query the employer results -->
<event-handler event="GetEmployerResults" access="public">
<notify listener="EmployerManager" method="GetEmployerResults"
resultKey="request.EmployerResults" />
<view-page name="EmployerSearchResults" contentKey="request.content"
/>
<view-page name="mainDisplayPage" />
</event-handler>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Deploy Web Applications Quickly across the enterprise with ColdFusion MX7 &
Flex 2
Free Trial
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJU
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:275062
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4