Likely a case sensitivity issue--double-check your casing. On Feb 16, 2010 8:16 AM, "Marco" <[email protected]> wrote:
Hi to all, i have a problem with the jquery plugin jqGrid (http:// www.trirand.com/blog/?page_id=5) I tried to reproduce the first example (http://www.trirand.com/ jqgridwiki/doku.php?id=wiki:first_grid) passing the query data with JSON, but the table doesn't show any result, it is empty. Can anyone help me?? Thanks in advance. MARCO Here is the code: THE CFM PAGE : <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <cfheader name="expires" value="#GetHttpTimeString(Now())#"> <cfheader name="pragma" value="no-cache"> <cfheader name="cache-control" value="no-cache, no-store, must- revalidate"> <title>Miseriaccia</title> <link rel="stylesheet" type="text/css" media="screen" href="../../ css/jquery/jqueryui/smoothness/jquery-ui-1.7.2.custom.css" /> <link rel="stylesheet" type="text/css" media="screen" href="../../ css/jquery/jqGrid/ui.jqgrid.css" /> <script src="../../js/jquery/jquery.min.js" type="text/javascript"></ script> <script src="../../js/jquery/jqueryui/jquery-ui-1.7.2.custom.min.js" type="text/javascript"></script> <script src="../../js/jquery/jqGrid/i18n/grid.locale-it.js" type="text/javascript"></script> <script src="../../js/jquery/jqGrid/jquery.jqGrid.min.js" type="text/ javascript"></script> <script type="text/javascript"> $(document).ready(function(){ $("#list").jqGrid({ url:'query.cfc?method=getUsers', datatype: 'json', mtype: 'GET', colNames:['FirstName','SecondName','Age', 'Birthdate'], colModel :[ {name:'FirstName', index:'FirstName', width:105, sorttype:"int"}, {name:'SecondName', index:'SecondName', width:200, sortable:false, sorttype:"date"}, {name:'Age', index:'Age', width:200, align:'right', sorttype:"int"}, {name:'Birthdate', index:'Birthdate', width:200, align:'right', sorttype:"string"}, ], pager: $('#pager'), rowNum:10, rowList:[10,20,30], sortname: 'IdPlan', sortorder: 'desc', width:'auto', viewrecords: true, caption: 'My first grid' }); }); </script> </head> <body> <table id="list"></table> <div id="pager"></div> </body> </html> THE CFC PAGE: <cfcomponent output="false"> <cffunction name="getUsers" access="remote" returnformat="json"> <cfargument name="page" required="false" default="1"> <cfargument name="rows" required="false" default="10"> <cfargument name="sidx" required="false" default=""> <cfargument name="sord" required="false" default="asc"> <cfset var arrUsers = ArrayNew(1)> <cfquery name="qry_data" datasource="DSNwebZv"> select FirstName,SecondName,Age,Birthdate from Users <cfif Arguments.sidx NEQ ""> order by #Arguments.sidx# #Arguments.sord# <cfelse> order by FirstName #Arguments.sord# </cfif> </cfquery> <cfset start = ((Arguments.page-1)*Arguments.rows)+1> <cfset end = (start-1)+Arguments.rows> <!--- <cfset arrPlan[i] = ['#FirstName#','#SecondName#',#Age#,'#Birthdate#']> ---> <cfloop query="qry_data" startrow="#start#" endrow="#end#"> <cfset riga = ArrayNew(1)> <cfset ArrayAppend(riga,#FirstName#)> <cfset ArrayAppend(riga,'#SecondName#')> <cfset ArrayAppend(riga,#Age#)> <cfset ArrayAppend(riga,'#Birthdate#')> <cfset ArrayAppend(arrPlan,riga)> </cfloop> <cfset totalPages = Ceiling(qry_data.recordcount/arguments.rows)> <cfset returnString = "{total=#totalPages#,page=#Arguments.page#,records=#qry_data.recordcount#,rows=#SerializeJSON(arrUsers )#}"> <cfreturn returnString> </cffunction> </cfcomponent> -- Open BlueDragon Public Mailing List http://www.openbluedragon.org/ http://twitter.com/OpenBlueDragon mailing list - http://groups.google.com/group/openbd?hl=en !! save a network - please trim replies before posting !! -- Open BlueDragon Public Mailing List http://www.openbluedragon.org/ http://twitter.com/OpenBlueDragon mailing list - http://groups.google.com/group/openbd?hl=en !! save a network - please trim replies before posting !!
