Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82115

ColdFusion 10 integration

$
0
0
With respect to the nicely documented example for ColdFusion (http://www.datatables.net/development/server-side/coldfusion) I was having some trouble making it work when DataTables was making a callback to the data provider. After a bit of digging, I discovered that DataTables has another property called sAjaxDataProp. This permits me to use the CF 8 function SerializeJSON(<query>) to easily populate the data source of DataTables. My rendering code now uses:
 
$('#example').dataTable( {
 	"bProcessing": true,
	"bServerSide": true,
	"sAjaxSource": "event_rest.cfm",	
        "sAjaxDataProp": "aaData.DATA", ...
Note that I am able to access an inner data structure in the JSON data by referencing it using dot notation for the sAjaxDataProp property.

while my dataprovider page (event_rest.cfm) looks like this:
<cfcontent reset="Yes" />
{"sEcho": <cfoutput>#val(url.sEcho)#</cfoutput>,
"iTotalRecords": <cfoutput>#qCount.total#</cfoutput>,
"iTotalDisplayRecords": <cfoutput>#qFiltered.recordCount#</cfoutput>,
"aaData": <cfoutput>#SerializeJSON(cfquery_name)#</cfoutput> 

Viewing all articles
Browse latest Browse all 82115

Trending Articles