<?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: jqgrid with Cold Fusion Samples</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/jqgrid-with-cold-fusion-samples</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/jqgrid-with-cold-fusion-samples/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>tony on jqgrid with Cold Fusion Samples</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/jqgrid-with-cold-fusion-samples#p4252</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/jqgrid-with-cold-fusion-samples#p4252</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>First - it is a good idea to start with documentation.</p>
<p>Hint use setGridParam method and postData array to do that.</p>
<p>Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Fri, 30 Jan 2009 09:42:42 +0200</pubDate>
        </item>
        <item>
        	<title>Jim P on jqgrid with Cold Fusion Samples</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/jqgrid-with-cold-fusion-samples#p4230</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/jqgrid-with-cold-fusion-samples#p4230</guid>
        	        	<description><![CDATA[<p>I&#39;m new to jquery/ jqgrid.&#160; I&#39;ve got the basic grid working with my data but I&#39;m stumped on&#160;providing extra filtering to my CFC.&#160; I need to pass in extra variables [<strong>myacct</strong>] to the query besides the grid info.&#160; I don&#39;t know where to put the variable in the grid.</p>
<p>This is my grid:</p>
<p>&#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&#39;" target="_blank">url:&#39;Users.cfc?method=GetAllCases&#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;], //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:50, sorttype:"int"},<br />&#160;&#160;&#160;&#160;&#160;{name:&#39;x_object_id&#39;,index:&#39;x_object_id&#39;, width:150, sorttype:"string"},<br />&#160;&#160;&#160;&#160;&#160;{name:&#39;x_site_id&#39;,index:&#39;x_site_id&#39;, width:150, align:"left",sorttype:"string"},<br />&#160;&#160;&#160;&#160;&#160;{name:&#39;x_site_name&#39;,index:&#39;x_site_name&#39;, width:150, align:"left",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: "ID", //Default sort column<br />&#160;&#160;&#160;&#160;<strong>myacct: "268440464",&#160; // my account</strong><br />&#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;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;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;</p>
<p>This is my CFC:</p>
<p>&#160;&#60;cffunction name="GetAllCases" access="remote" returnformat="json"&#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="myacct" type="string" required="yes" hint="Biz Org to get "&#62;&#160;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<br />&#160;&#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<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; Where&#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;&#160;</p>
<p>&#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#]&#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;</p>
<p>&#160;&#160;&#60;!--- &#60;cfreturn get_cases&#62; ---&#62;&#160;&#160;<br />&#160;&#60;/cffunction&#62;</p>
<p>Firebug error is that the variable is not declared.</p>
<p>How do I do this?</p>
<p>Thanks,&#160; Jim</p></p>
]]></description>
        	        	<pubDate>Thu, 29 Jan 2009 14:03:42 +0200</pubDate>
        </item>
</channel>
</rss>