Handler
<cffunction name="dspNestedXMLDataSet" access="public" returntype="void" output="false">
<cfargument name="Event" type="coldbox.system.beans.requestContext">
<cfset var spry = getPlugin("Spry",true)>
<cfset Spry.setIsDebug(0)>
<cfset spry.setXMLDataSet("dsUserList1_parentDs","?event=spryExample.getUsersXML","USERS","useCache: false")>
<cfset spry.setNestedXMLDataSet("dsUserList1","dsUserList1_parentDs","USER","useCache:false")>
<cfset spry.setXMLDataSet("dsUserList2_parentDs","null","USERS","useCache: false")>
<!--- Create js function to fill data set dsUserList2 --->
<cfset spry.setNestedXMLDataSet("dsUserList2","dsUserList2_parentDs","USER")>
<cfset spry.setJavascript("function getUserList2(){dsUserList2_parentDs.setURL('?event=spryExample.getUsersXML');dsUserList2_parentDs.loadData();}",true)>
<cfset spry.setCSSLink("includes/css/list.css","screen")>
<cfset Event.setView("spryExample/dataSet")>
</cffunction>
<cffunction name="getUsersXML" access="public" returntype="void" output="false">
<cfargument name="Event" type="coldbox.system.beans.requestContext">
<cfset var toXML = getPlugin("toXML",true)>
<!--- Get query users --->
<cfset var users = getUsers()>
<!--- Convert query to XML --->
<cfset Event.setValue("data",toXML.queryToXML(users,"USERS","USER"))>
<!--- Call AjaxProxy to output XML data. Set isXML for proper content type --->
<cfset Event.setValue("isXML",true)>
<cfset Event.setView("ajaxProxy",true)>
</cffunction>
View
<div spry:region="dsUserList1" id="dsUserList1Region">
<table class="list">
<thead>
<tr>
<th width="150">First name</th>
<th>Last name</th>
</tr>
</thead>
<tbody spry:state="loading">
<tr>
<td colspan="2">Please wait</td>
</tr>
</tbody>
<tbody spry:repeat="dsUserList1" spry:state="ready">
<tr class="{ds_EvenOddRow}" spry:hover="hover" spry:select="selected"
onclick="alert('RowID {ds_RowID} clicked')">
<td>{FIRSTNAME}</td>
<td>{LASTNAME}</td>
</tr>
</tbody>
</table>
</div>
<br /><br />
<a href="javascript:getUserList2()">Get records sample 2</a>
<br />
<br />
<div spry:region="dsUserList2" id="dsUserList2Region">
<table class="list">
<thead>
<tr>
<th width="150">First name</th>
<th>Last name</th>
</tr>
</thead>
<tbody spry:state="loading">
<tr>
<td colspan="2">Please wait</td>
</tr>
</tbody>
<tbody spry:repeat="dsUserList2" spry:state="ready">
<tr class="{ds_EvenOddRow}" spry:hover="hover" spry:select="selected" onclick="alert( '{FIRSTNAME} {LASTNAME}')">
<td>{FIRSTNAME}</td>
<td>{LASTNAME}</td>
</tr>
</tbody>
</table>
</div>