I use following SQL to create a table and enter some data and cfc file to generate JSON data and change url to Example.cfc, but no luck,
I am looking for CSS and JS file to see any mistake there,
Thanks again for helping,
Iccsi,
CREATETABLE invheader (
invid int(11)NOTNULLAUTO_INCREMENT,
invdate date NOTNULL,
client_id int(11)NOTNULL,
amount decimal(10,2)NOTNULLDEFAULT'0.00',
tax decimal(10,2)NOTNULLDEFAULT'0.00',
total decimal(10,2)NOTNULLDEFAULT'0.00',
note char(100)DEFAULTNULL,
PRIMARYKEY (invid)
);
<cffunction name="getLoc" access="remote" returntype="any" returnformat="json">
<cfquery name="qryLoc">
SELECT invid, invdate, client_id, amount, tax, notes FROM invheader
</cfquery>
<cfoutput>
<cfset i = 1>
<cfset data = ArrayNew(1)>
<cfloop query="qryLoc">
<cfset row = StructNew()>
<cfset row["invid"] = "#qryLoc.invid#">
<cfset row["invdate"] = "#qryLoc.invdate#">
<cfset row["client_id"] = "#qryLoc.client_id#">
<cfset row["amount"] = "#qryLoc.amount#">
<cfset row["tax"] = "#qryLoc.tax#">
<cfset row["note"] = "#qryLoc.note#">
<cfset data[i] = row>
<cfset i = i + 1>
</cfloop>
<!— Caution !!! : turn off the CF debuging, because
garbage could be sezialised with the retrieved data —>
<cfreturn #serializeJSON(data)#>
<cfreturn stcReturn>--->
</cfoutput>
</cffunction>
$(function () {
$("#list").jqGrid({
url: "Example.cfc?method=getLoc",
datatype: "json",
mtype: "GET",
colNames: ["Inv No", "Date", "Amount", "Tax", "Total", "Notes"],
colModel: [
{ name: "invid", width: 55 },
{ name: "invdate", width: 90 },
{ name: "amount", width: 80, align: "right" },
{ name: "tax", width: 80, align: "right" },
{ name: "total", width: 80, align: "right" },
{ name: "note", width: 150, sortable: false }
],
pager: "#pager",
rowNum: 10,
rowList: [10, 20, 30],
sortname: "invid",
sortorder: "desc",
viewrecords: true,
gridview: true,
autoencode: true,
caption: "My first grid"
});
});