<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
	<title>jQuery Grid Plugin - jqGrid - Topic: Cold Fusion cfc Sub grid Problem</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/cold-fusion-cfc-sub-grid-problem</link>
	<description><![CDATA[Grid plugin]]></description>
	<generator>Simple:Press Version 5.7.5.3</generator>
	<atom:link href="http://www.trirand.com/blog/?page_id=393/help/cold-fusion-cfc-sub-grid-problem/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>tony on Cold Fusion cfc Sub grid Problem</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/cold-fusion-cfc-sub-grid-problem#p4316</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/cold-fusion-cfc-sub-grid-problem#p4316</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>The problem maybe is that you use capital words when you return the data, by derfault this definition is with little words - i.e. you use "ROWS" - in the subgrid definition this is "rows".</p>
<p>Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Tue, 03 Feb 2009 01:40:44 +0200</pubDate>
        </item>
        <item>
        	<title>Jim P on Cold Fusion cfc Sub grid Problem</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/cold-fusion-cfc-sub-grid-problem#p4301</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/cold-fusion-cfc-sub-grid-problem#p4301</guid>
        	        	<description><![CDATA[<p>I&#39;m using Cold Fusion CFC to handle the data, not php.&#160; I&#39;ve got a grid with a subgrid that is returning jason for the subgrid data, but I&#39;m getting this error:</p>
<p><span class="objectBox objectBox-errorMessage hasTwisty hasBreakSwitch opened">sjxml[sgmap.root] is undefined</span></p>
<p><span class="objectBox objectBox-errorMessage hasTwisty hasBreakSwitch opened">I&#39;ve been searching the jqgrid (V3.3 - Oct 08) manual to no avail.&#160; I got my code from the manual and modified to use CF cfc.</span></p>
<p><span class="objectBox objectBox-errorMessage hasTwisty hasBreakSwitch opened">If I run my cfc call: I get jason back:</span></p>
<p><span class="objectBox objectBox-errorMessage hasTwisty hasBreakSwitch opened">{"ROWS":[["3218798-1","FS","October, 10 2008 15:15:13","Open sub case to track Issues with system"]],"PAGE":1.0,"TOTAL":1.0,"RECORDS":1}</span></p>
<p><span class="objectBox objectBox-errorMessage hasTwisty hasBreakSwitch opened">Then the error:</span></p>
<p><span class="objectBox objectBox-errorMessage hasTwisty hasBreakSwitch opened">How do I define the sqmap.root?</span></p>
<p><span class="objectBox objectBox-errorMessage hasTwisty hasBreakSwitch opened">How can I dynamically control the +/- on the main grid row if there are subrows?</span></p>
<p><span class="objectBox objectBox-errorMessage hasTwisty hasBreakSwitch opened">TIA - Jim</span></p>
<p><span class="objectBox objectBox-errorMessage hasTwisty hasBreakSwitch opened">Here&#39;s my code:</span></p>
<p><span class="objectBox objectBox-errorMessage hasTwisty hasBreakSwitch opened">&#60;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&#62;<br />&#60;html&#62;<br />&#60;head&#62;<br />&#60;title&#62;jqGrid Demo&#60;/title&#62;<br />&#60;link rel="stylesheet" type="text/css" media="screen" href="themes/coffee/grid.css" /&#62;<br />&#60;link rel="stylesheet" type="text/css" media="screen" href="themes/jqModal.css" /&#62;<br />&#60;!--- &#60;cfset session.myacct = "268440464"&#62; ---&#62;<br />&#60;script src="jquery.js" type="text/javascript"&#62;&#60;/script&#62;<br />&#60;script src="jquery.jqGrid.js" type="text/javascript"&#62;&#60;/script&#62;<br />&#60;script src="js/jqModal.js" type="text/javascript"&#62;&#60;/script&#62;<br />&#60;script src="js/jqDnR.js" type="text/javascript"&#62;&#60;/script&#62;</span></p>
<p><span class="objectBox objectBox-errorMessage hasTwisty hasBreakSwitch opened">&#160;&#60;script&#62;<br />&#160;$(document).ready(function()<br />&#160;&#160;{<br />&#160;&#160;&#160;$("#list").jqGrid(<br />&#160;&#160;&#160;{<br />&#160;&#160;&#160;&#160;<a href="&#39;Users.cfc?method=GetAllCases&#38;myacct=&#60;cfoutput&#62;#session.bizorg_objid#&#60;/cfoutput&#62;&#39;" target="_blank">url:&#39;Users.cfc?method=GetAllCases&#38;myacct=&#60;cfoutput&#62;#session.bizorg_objid#&#60;/cfoutput&#62;&#39;</a>, //CFC that will return the users<br />&#160;&#160;&#160;&#160;datatype: &#39;json&#39;, //We specify that the datatype we will be using will be JSON<br />&#160;&#160;&#160;&#160;colNames:[&#39;ID&#39;,&#39;Case Number&#39;,&#39;Site ID&#39;,&#39;Site Name&#39;, &#39;Objid&#39;], //Column Names<br />&#160;&#160;&#160;&#160;//The Column Model to define the data. Note you can make columns non sortable, specify width, alignment, etc.<br />&#160;&#160;&#160;&#160;// [#objid#,#x_account_id#,#x_site_id#,#x_site_name#]&#62;<br />&#160;&#160;&#160;&#160;colModel :[<br />&#160;&#160;&#160;&#160;&#160;{name:&#39;objid&#39;,index:&#39;objid&#39;, width:100, sorttype:"int"},<br />&#160;&#160;&#160;&#160;&#160;{name:&#39;x_object_id&#39;,index:&#39;x_object_id&#39;, width:100, align:"center", sorttype:"string"},<br />&#160;&#160;&#160;&#160;&#160;{name:&#39;x_site_id&#39;,index:&#39;x_site_id&#39;, width:100, align:"center",sorttype:"string"},<br />&#160;&#160;&#160;&#160;&#160;{name:&#39;x_site_name&#39;,index:&#39;x_site_name&#39;, width:200, align:"left",sorttype:"string"},<br />&#160;&#160;&#160;&#160;&#160;{name:&#39;x_object_objid&#39;,index:&#39;x_object_objid&#39;, width:1, align:"center", hidden:"true", sorttype:"string"}<br />&#160;&#160;&#160;&#160;&#160;//{name:&#39;UserName&#39;,index:&#39;UserName&#39;, width:150,align:"left",sorttype:"string"},<br />&#160;&#160;&#160;&#160;&#160;//{name:&#39;UserAccountingCode&#39;,index:&#39;UserAccountingCode&#39;, width:150, sortable:false},<br />&#160;&#160;&#160;&#160;&#160;//{name:&#39;Phone&#39;,index:&#39;Phone&#39;, width:150, sortable:false}<br />&#160;&#160;&#160;&#160;],<br />&#160;&#160;&#160;&#160;pager: $(&#39;#pager&#39;), //The div we have specified, tells jqGrid where to put the pager<br />&#160;&#160;&#160;&#160;rowNum:20, //Number of records we want to show per page<br />&#160;&#160;&#160;&#160;rowList:[4,8,12], //Row List, to allow user to select how many rows they want to see per page<br />&#160;&#160;&#160;&#160;sortorder: "desc", //Default sort order<br />&#160;&#160;&#160;&#160;sortname: "x_object_id", //Default sort column<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;//myDSN: "ClarifySMST", // pass in required vars<br />&#160;&#160;&#160;&#160;viewrecords: true, //Shows the nice message on the pager<br />&#160;&#160;&#160;&#160;imgpath: &#39;themes/coffee/images&#39;, //Image path for prev/next etc images<br />&#160;&#160;&#160;&#160;caption: &#39;Open Cases&#39;, //Grid Name<br />&#160;&#160;&#160;&#160;subGrid: true, // make it a subgrid<br />&#160;&#160;&#160;&#160;subGridUrl: &#39;Users.cfc?method=GetSubCases&#39;, //CFC that will return the users<br />&#160;&#160;&#160;&#160;subGridModel: [{<br />&#160;&#160;&#160;&#160;&#160;&#160; name: [&#39;x_object_id&#39;,&#39;x_priority&#39;,&#39;x_creation_dt&#39;,&#39;x_title&#39;], //Column Names<br />&#160;&#160;&#160;&#160;&#160;&#160; width: [100, 100, 100, 200],<br />&#160;&#160;&#160;&#160;&#160;&#160; params: [&#39;x_object_id&#39;]}<br />&#160;&#160;&#160;&#160;],<br />&#160;&#160;&#160;&#160;height:&#39;auto&#39;, //I like auto, so there is no blank space between. Using a fixed height can mean either a scrollbar or a blank space before the pager<br />&#160;&#160;&#160;&#160;recordtext:&#39;Total Records&#39;, //On the demo you will notice "7 Total Records" - The Total Reocrds text comes from here<br />&#160;&#160;&#160;&#160;pgtext:&#39;of&#39;,//You notice the 1/3, you can change the /. You can make it say 1 of 3<br />&#160;&#160;&#160;&#160;postdata: "",&#160; // my account<br />&#160;&#160;&#160;&#160;editurl:"Users.cfc?method=GetAllCases",//Not used right now.<br />&#160;&#160;&#160;&#160;toolbar:[true,"top"],//Shows the toolbar at the top. I will decide if I need to put anything in there later.<br />&#160;&#160;&#160;&#160;//The JSON reader. This defines what the JSON data returned from the CFC should look like<br />&#160;&#160;&#160;&#160;jsonReader: {<br />&#160;&#160;&#160;&#160;&#160;root: "ROWS",<br />&#160;&#160;&#160;&#160;&#160;page: "PAGE",<br />&#160;&#160;&#160;&#160;&#160;total: "TOTAL",<br />&#160;&#160;&#160;&#160;&#160;records:"RECORDS",<br />&#160;&#160;&#160;&#160;&#160;cell: "",<br />&#160;&#160;&#160;&#160;&#160;id: "0"<br />&#160;&#160;&#160;&#160;&#160;}<br />&#160;&#160;&#160;&#160;}<br />&#160;&#160;&#160;);&#160;&#160;&#160;<br />&#160;&#160;&#160;<br />&#160;&#160;}<br />&#160;);<br />&#160;&#60;/script&#62;<br />&#60;/head&#62;</span></p>
<p><span class="objectBox objectBox-errorMessage hasTwisty hasBreakSwitch opened">&#60;body&#62;</span></p>
<p><span class="objectBox objectBox-errorMessage hasTwisty hasBreakSwitch opened">&#160;&#60;table id="list" class="scroll" cellpadding="0" cellspacing="0"&#62;&#60;/table&#62;<br />&#160;&#60;div id="pager" class="scroll" style="text-align:center;"&#62;&#60;/div&#62;<br />&#160;&#60;div id="mysearch"&#62;&#60;/div&#62;<br />&#60;/body&#62;<br />&#60;/html&#62;</span></p>
<p><span class="objectBox objectBox-errorMessage hasTwisty hasBreakSwitch opened">Here&#39;s my cfc:</span></p>
<p><span class="objectBox objectBox-errorMessage hasTwisty hasBreakSwitch opened">&#60;cfcomponent output="false"&#62;<br />&#160;&#160;&#160;&#160; &#60;!--- ======================================== ---&#62;<br />&#160;&#160;&#160;&#160; <br />&#160;&#60;cffunction name="GetAllCases" access="remote" returnformat="json"&#62;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;cfargument name="page" required="no" default="1" hint="Page user is on"&#62;<br />&#160;&#160;&#160;&#160; &#60;cfargument name="rows" required="no" default="15" hint="Number of Rows to display per page"&#62;<br />&#160;&#160;&#160;&#160; &#60;cfargument name="sidx" required="no" default="" hint="Sort Column"&#62;<br />&#160;&#160;&#160;&#160; &#60;cfargument name="sord" required="no" default="ASC" hint="Sort Order"&#62;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;cfargument name="myacct" required="no"&#160; hint="Biz Org to get "&#62;<br />&#160;&#160;&#160;&#160; &#60;!---&#160;&#160;&#160; &#60;cfargument name="nd" required="no" default="0"&#62;&#160;&#160; ---&#62; <br />&#160;&#160;&#160;&#160;&#160;&#160; &#160;<br />&#160;&#160;&#160; &#160;&#60;cfset var arrCases = ArrayNew(1)&#62;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#60;cfquery datasource="ClarifySMST" name="get_cases"&#62;<br />&#160;&#160;&#160;select objid, x_object_id, x_site_id, x_site_name, x_object_objid<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; from SA.TABLE_X_PORTAL_OBJECT<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; WHERE x_parent_id is null<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; AND&#160;&#160; x_bus_org_objid = &#60;cfqueryparam cfsqltype="cf_sql_integer" value="#myacct#"&#62;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;!---&#160;&#160; ---&#62;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#60;!--- Sorting Here ---&#62;<br />&#160;&#160;&#160;&#60;cfif Arguments.sidx NEQ ""&#62;&#160;<br />&#160;&#160;&#160;&#160;ORDER BY #Arguments.sidx# #Arguments.sord#<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;cfelse&#62;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ORDER BY x_object_id&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#60;/cfif&#62;</span></p>
<p><span class="objectBox objectBox-errorMessage hasTwisty hasBreakSwitch opened">&#160;&#160;&#60;/cfquery&#62;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#60;!--- Calculate the Start Position for the loop query.<br />&#160;&#160;So, if you are on 1st page and want to display 4 rows per page, for first page you start at: (1-1)*4+1 = 1.<br />&#160;&#160;If you go to page 2, you start at (2-)1*4+1 = 5&#160; ---&#62;<br />&#160;&#160;&#60;cfset start = ((arguments.page-1)*arguments.rows)+1&#62;<br />&#160;&#160;<br />&#160;&#160;&#60;!--- Calculate the end row for the query. So on the first page you go from row 1 to row 4. ---&#62;<br />&#160;&#160;&#60;cfset end = (start-1) + arguments.rows&#62;<br />&#160;&#160;<br />&#160;&#160;&#60;!--- When building the array ---&#62;<br />&#160;&#160;&#60;cfset i = 1&#62;<br />&#160;&#160;<br />&#160;<br />&#160;&#160;&#60;cfloop query="get_cases" startrow="#start#" endrow="#end#"&#62;<br />&#160;&#160;&#160;&#60;!--- Array that will be passed back needed by jqGrid JSON implementation ---&#62;&#160;&#160;<br />&#160;&#160;&#160;&#60;cfset arrCases[i] = [#objid#,#x_object_id#,#x_site_id#,#x_site_name#,#x_object_objid#]&#62;<br />&#160;&#160;&#160;&#60;cfset i = i + 1&#62;&#160;&#160;&#160;<br />&#160;&#160;&#60;/cfloop&#62;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#60;!--- Calculate the Total Number of Pages for your records. ---&#62;<br />&#160;&#160;&#60;cfset totalPages = Ceiling(get_cases.recordcount/arguments.rows)&#62;<br />&#160;&#160;<br />&#160;&#160;&#60;!--- The JSON return. <br />&#160;&#160;&#160;Total - Total Number of Pages we will have calculated above<br />&#160;&#160;&#160;Page - Current page user is on<br />&#160;&#160;&#160;Records - Total number of records<br />&#160;&#160;&#160;rows = our data <br />&#160;&#160;---&#62;<br />&#160;&#160;&#60;cfset stcCases = {total=#totalPages#,page=#Arguments.page#,records=#get_cases.recordcount#,rows=arrCases}&#62;<br />&#160;&#160;<br />&#160;&#160;&#60;cfreturn stcCases&#62;</span></p>
<p><span class="objectBox objectBox-errorMessage hasTwisty hasBreakSwitch opened">&#160;&#160;&#60;!--- &#60;cfreturn get_cases&#62; ---&#62;&#160;&#160;<br />&#160;&#60;/cffunction&#62;&#160; <br />&#160;&#160;&#160;&#160; &#60;!--- ======================================== ---&#62;<br />&#160;&#160;&#160;&#160; <br />&#160;&#60;cffunction name="GetSubCases" access="remote" returnformat="json"&#62;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;cfargument name="x_object_objid" required="no"&#160; hint="Biz Org to get "&#62; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;!------&#62;<br />&#160;&#160;&#160; &#160;&#60;cfargument name="page" required="no" default="1" hint="Page user is on"&#62;<br />&#160;&#160;&#160;&#160; &#60;cfargument name="rows" required="no" default="15" hint="Number of Rows to display per page"&#62;<br />&#160;&#160;&#160;&#160; &#60;cfargument name="sidx" required="no" default="" hint="Sort Column"&#62;<br />&#160;&#160;&#160;&#160; &#60;cfargument name="sord" required="no" default="ASC" hint="Sort Order"&#62;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;cfargument name="nd" required="no" default="0"&#62;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160; <br />&#160;&#160;&#160; &#160;&#60;cfset var arrCases = ArrayNew(1)&#62;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#60;cfquery datasource="ClarifySMST" name="get_subcases"&#62;<br />&#160;&#160;&#160;select x_object_id, x_priority, x_creation_dt, x_title<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; from SA.TABLE_X_PORTAL_OBJECT<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; WHERE x_parent_id = &#39;#arguments.x_object_id#&#39;&#160;&#160;&#160; <br />&#160;&#160;&#60;/cfquery&#62;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#60;!--- Calculate the Start Position for the loop query.<br />&#160;&#160;So, if you are on 1st page and want to display 4 rows per page, for first page you start at: (1-1)*4+1 = 1.<br />&#160;&#160;If you go to page 2, you start at (2-)1*4+1 = 5&#160; ---&#62;<br />&#160;&#160;&#60;cfset start = ((arguments.page-1)*arguments.rows)+1&#62;<br />&#160;&#160;<br />&#160;&#160;&#60;!--- Calculate the end row for the query. So on the first page you go from row 1 to row 4. ---&#62;<br />&#160;&#160;&#60;cfset end = (start-1) + arguments.rows&#62;<br />&#160;&#160;<br />&#160;&#160;&#60;!--- When building the array ---&#62;<br />&#160;&#160;&#60;cfset i = 1&#62;<br />&#160;&#160; <br />&#160;&#160;&#60;cfloop query="get_subcases" startrow="#start#" endrow="#end#"&#62;<br />&#160;&#160;&#160;&#60;!--- Array that will be passed back needed by jqGrid JSON implementation ---&#62;&#160;&#160;<br />&#160;&#160;&#160;&#60;cfset arrCases[i] = [#x_object_id#,#x_priority#,#x_creation_dt#,#x_title#]&#62;<br />&#160;&#160;&#160;&#60;cfset i = i + 1&#62;&#160;&#160;&#160;<br />&#160;&#160;&#60;/cfloop&#62;<br />&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#60;!--- Calculate the Total Number of Pages for your records. ---&#62;<br />&#160;&#160;&#60;cfset totalPages = Ceiling(get_subcases.recordcount/arguments.rows)&#62;<br />&#160;&#160;<br />&#160;&#160;&#60;!--- The JSON return. <br />&#160;&#160;&#160;Total - Total Number of Pages we will have calculated above<br />&#160;&#160;&#160;Page - Current page user is on<br />&#160;&#160;&#160;Records - Total number of records<br />&#160;&#160;&#160;rows = our data <br />&#160;&#160;---&#62;<br />&#160;&#160;&#60;cfset stcSubCases = {total=#totalPages#,page=#Arguments.page#,records=#get_subcases.recordcount#,rows=arrCases}&#62;<br />&#160;&#160;<br />&#160;&#160;&#60;cfreturn stcSubCases&#62;&#160;<br />&#160;&#60;/cffunction&#62; <br />&#60;/cfcomponent&#62;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span></p></p>
]]></description>
        	        	<pubDate>Mon, 02 Feb 2009 14:54:18 +0200</pubDate>
        </item>
</channel>
</rss>