jqGrid Server side
i use jqgrid project using following server side code coldfusion in cfc file.
the jqgrid works few pages.
i can scroll couple of page using jqgrid pager.
it seems page , records information not send jqgrid correctly.
do need particular pass row, pages , records information client make server response correct pages?
your , information great appreciated,
regards,
iccsi,
<cffunction name="ccdclaimslookup" access="remote" returnformat="json">
<cfargument name ="startdate" required="no" default="">
<cfargument name ="enddate" required="no" default="">
<cfargument name="page" required="no" default="1">
<cfargument name="rows" required="no" default="10">
<cfargument name="sidx" required="no" default="">
<cfargument name="sord" required="no" default="asc">
<cfset var mydata = arraynew(1)>
<cfset start = ((arguments.page-1)*arguments.rows)+1>
<cfset end = (start-1) + arguments.rows>
<cfset = 1>
<cfstoredproc procedure="mysp">
<cfprocparam value = "#startdate#" cfsqltype = "cf_sql_date">
<cfprocparam value = "#enddate#" cfsqltype = "cf_sql_date">
<cfprocresult name="spname" resultset="1">
</cfstoredproc>
<cfloop query="spname" startrow="#start#" endrow="#end#">
<cfset mydata[i] = [#myid#,#myname#,#mydate#,#mynote#]>
<cfset = + 1>
</cfloop>
<cfset totalpages = ceiling(spname.recordcount/arguments.rows)>
<cfset stcreturn = {total=#totalpages#,page=#arguments.page#,records=#spname.recordcount#,rows=#mydata#}>
<cfreturn #serializejson(stcreturn, true)#>
</cffunction>
@isccsi,
i can't comment on data passing jqgrid, haven't used jquery plugin myself. did notice 1 thing problem. using serializejson() function on data, specifying returnformat on function json. specifying returnformat causes value being returned automatically serialized json; thus, serializing data twice (once calling serializejson function, coldfusion again automatically when returns data). may cause json become malformed.
since not returning query directly function (you looping through , building array of arrays), shouldn't need serializejson call @ all. should able return stcreturn variable.
hth,
carl v.
More discussions in ColdFusion
adobe
Comments
Post a Comment