jQuery UI Widgets › Forums › Grid › Grid and Coldfusion – no data to display
Tagged: Coldfusion, data, jqxgrid
This topic contains 1 reply, has 2 voices, and was last updated by ivailo 9 years, 8 months ago.
-
Author
-
Hi, I’m trying to get the grid to work with coldfusion. If I call the cfc directly it displays the json, but the grid says no data to display. My code is below . Thanks!
<cfcomponent>
<cffunction name=”grant” access=”remote”>
<cfquery name=”alldata” datasource=”finance_dashboard”>
select grants.grantindex,grants.grantid,grants.title,grants.shortname,grants.pi,grants.costcenter,grants.authgroup,
reportdue.reportduedate,reportdue.status, reportdue.reportdueindex, reportdue.comments, DATEDIFF(reportdue.ReportDueDate, NOW()) as d ,
max(comments.CommentDate) as maxd
from grants
left join reportdue on grants.grantindex=reportdue.grantindex
left join comments on reportdue.ReportDueIndex=comments.ReportDueIndex
GROUP BYreportdue
.ReportDueIndex
order by grants.costcenter
</cfquery><cfset rData = ArrayNew(1)>
<cfloop query=”alldata”>
<cfset row = StructNew()>
<cfset row[“grantindex”] = alldata.grantindex>
<cfset row[“title”] = alldata.title>
<cfset rdata[alldata.currentrow] = row>
</cfloop><cfset theOutput = serializeJSON(rData)>
<cfreturn theOutput>
</cffunction></cfcomponent>
<cfinclude template=”menu.cfm”>
<cfinclude template=”widgets.cfm”><script type=”text/javascript”>
$(document).ready(function () {var projectSource =
{
datatype: “json”,
datafields: [
{name: ‘grantindex’},
{name: ‘title’, type: ‘string’}
],
url: ‘j3.cfc?method=grant’,
id: ‘grantindex’,};
var dataAdapter = new $.jqx.dataAdapter(projectSource);
$(“#projectGrid”).jqxGrid({
width: 1000,
autoheight:true,
columnsresize: true,
pagesize: 25,
source: dataAdapter,
pageable: true,
autoheight: true,
filterable: true,
sortable: true,
enabletooltips: true,
showtoolbar: true,
showfilterrow: true,
theme: ‘energyblue’,
columns: [
{text: ‘GI’, datafield: ‘grantindex’, width: 150},
{text: ‘Title’, datafield: ‘title’, width: 150}]
});});
</script>
<div id=’jqxWidget’ style=”font-size: 13px; font-family: Verdana; float: left;”></div>
<div style=”width: 60%; margin:0 auto” id=”projectGrid”></div><div id=”editDiv”></div>
Hi smithgr@jhmi.edu,
We don’t have experience with Coldfusion, but i tested your code with localdata an it seems to be ok.
Here is the fiddle.Verify your json, to be exact like the localdata in fiddle.
If this doesn’t help share the error message in your console.
Best Regards,
Ivailo IvanovjQWidgets Team
http://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.