<?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: beforeProcessing doesn't seem to work?</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/beforeprocessing-doesnt-seem-to-work</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/beforeprocessing-doesnt-seem-to-work/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>earachefl on beforeProcessing doesn't seem to work?</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/beforeprocessing-doesnt-seem-to-work#p25849</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/beforeprocessing-doesnt-seem-to-work#p25849</guid>
        	        	<description><![CDATA[<p>EDIT: As it turns out, updating the plugin to the latest version fixed my beforeProcessing problem.&#160;</p>
</p>
<p>EDIT: if I revert to my original code, so that I return the object that jqGrid expects, and then successfully reload the grid, NOTHING ever runs inside beforeProcessing(){} &#8211; not a simple alert(&#39;hi&#39;); and not a simple console.log(&#39;hi there&#39;); &#8211; but I thought that beforeProcessing was supposed to run after a successful ajax call? It sure doesn&#39;t seem to work.</p>
<p>I&#39;m initializing my grid like so:</p>
</p>
<p>$("#mainGrid").jqGrid({</p>
<p><span style="white-space: pre;"> </span>url : g_MainGridUrl,</p>
<p><span style="white-space: pre;"> </span>datatype : &#39;json&#39;,</p>
<p><span style="white-space: pre;"> </span>height : 660,</p>
<p><span style="white-space: pre;"> </span>autowidth : true,</p>
<p><span style="white-space: pre;"> </span>colNames : g_ColNames,</p>
<p><span style="white-space: pre;"> </span>colModel : g_ColModel,</p>
<p><span style="white-space: pre;"> </span>pager : &#39;#pager&#39;,</p>
<p><span style="white-space: pre;"> </span>rowNum : 100,</p>
<p><span style="white-space: pre;"> </span>rowList : [100, 200, 300],</p>
<p><span style="white-space: pre;"> </span>sortname : g_DefaultSort,</p>
<p><span style="white-space: pre;"> </span>sortorder : &#39;desc&#39;,</p>
<p><span style="white-space: pre;"> </span>sortable: true,</p>
<p><span style="white-space: pre;"> </span>viewrecords : true,</p>
<p><span style="white-space: pre;"> </span>caption : &#39;Results&#39;,</p>
<p><span style="white-space: pre;"> </span>hidegrid : false,</p>
<p><span style="white-space: pre;"> </span>rownumbers : true,</p>
<p><span style="white-space: pre;"> </span>jsonReader : {</p>
<p><span style="white-space: pre;"> </span>root : "ROWS",</p>
<p><span style="white-space: pre;"> </span>page : "PAGE",</p>
<p><span style="white-space: pre;"> </span>total : "TOTAL",</p>
<p><span style="white-space: pre;"> </span>records : "RECORDS",</p>
<p><span style="white-space: pre;"> </span>cell : "",</p>
<p><span style="white-space: pre;"> </span>id : g_DefaultSort</p>
<p><span style="white-space: pre;"> </span>},</p>
<p><span style="white-space: pre;"> </span>beforeProcessing: function(data, status, xhr){</p>
<p><span style="white-space: pre;"> </span>console.log(data);</p>
<p><span style="white-space: pre;"> </span>},</p>
<p><span style="white-space: pre;"> </span>loadError: function(xhr, status, error){</p>
<p><span style="white-space: pre;"> </span>alert(xhr.statusText);</p>
<p><span style="white-space: pre;"> </span>},</p>
<p><span style="white-space: pre;"> </span>loadComplete: function(data){</p>
<p><span style="white-space: pre;"> </span>//console.log(data);</p>
<p><span style="white-space: pre;"> </span>// more stuff happens here</p>
<p><span style="white-space: pre;"> </span>}</p>
<p>});</p>
</p>
<p>and whenever I want to update the grid, I&#39;m calling it like so:</p>
</p>
<p>$(&#39;#mainGrid&#39;).setGridParam({</p>
<p><span style="white-space: pre;"> </span>url : g_MainGridUrl + Ext.util.JSON.encode(filter)</p>
<p>});</p>
<p>$(&#39;#mainGrid&#39;).trigger("reloadGrid");</p>
</p>
<p>My problem is this: I&#39;m trying to implement a uniform error handler in Coldfusion, so that remote cfc calls that have errors don&#39;t just return status=200 responses and die without letting the user know that an error occurred. To that end, I&#39;m trying Ben Nadel&#39;s model and returning a uniform struct that&#39;s formed like so:</p>
</p>
<p>RESPONSE.SUCCESS = "false"</p>
<p>RESPONSE.ERRORS = [array of errors]</p>
<p>RESPONSE.DATA = {normal data that jqgrid expects}</p>
</p>
<p>From reading your docs, I tried implementing</p>
<p>beforeProcessing: function(data){</p>
<p><span style="white-space: pre;"> </span>console.log(data + &#39;hi&#39;); // just to test whether it&#39;s working</p>
<p>}</p>
<p>in my initialization code, but nothing is output to the console, whether when first initialized or called again.</p>
</p>
<p>So I thought that I should be setting ajaxGridOptions{} instead, but I can&#39;t figure out how to make it work &#8211; I need to set a RESPONSE.SUCCESS handler that remaps RESPONSE.DATA to the data object expected by jqGrid, and I also need to set a RESPONSE.SUCCESS == &#39;false&#39; handler as well. My experiments so far have not been fruitful.</p>
</p>
<p>Thanks for any help.</p>
]]></description>
        	        	<pubDate>Tue, 31 Jan 2012 16:50:53 +0200</pubDate>
        </item>
</channel>
</rss>