<?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: "Prefix serialized JSON with" setting in ColdFusion</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/prefix-serialized-json-with-setting-in-coldfusion</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/prefix-serialized-json-with-setting-in-coldfusion/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>gfrobenius on "Prefix serialized JSON with" setting in ColdFusion</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/prefix-serialized-json-with-setting-in-coldfusion#p24095</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/prefix-serialized-json-with-setting-in-coldfusion#p24095</guid>
        	        	<description><![CDATA[<p>Thanks, but yeah, I&#39;m aware of the setting and everything works fine when it&#39;s off. &#160;We will have jqGrid on literally 1000s of screens and don&#39;t want to paint ourselves into a corner if down the road we are required to turn this extra security feature on. &#160;Removing it on the CF end before sending it back to the jqGrid bypasses that feature all together (but is do-able). &#160;Guess I&#39;ll have to look "under the jqGrid js hood" and find where the response is coming back and put my own hook in. &#160;Thanks.</p>
]]></description>
        	        	<pubDate>Fri, 29 Jul 2011 00:45:36 +0300</pubDate>
        </item>
        <item>
        	<title>Ken on "Prefix serialized JSON with" setting in ColdFusion</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/prefix-serialized-json-with-setting-in-coldfusion#p24094</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/prefix-serialized-json-with-setting-in-coldfusion#p24094</guid>
        	        	<description><![CDATA[<p>Hi</p>
</p>
<p>Sorry I was not able to help.&#160;</p>
<p>I don&#39;t mean to state the obvious but are you able to change settings in the administrator?</p>
<p>Have a look under settings is so about half way down.</p>
<p>"Prefix serialized JSON with<br />Protects web services which return JSON data from cross-site scripting attacks by prefixing serialized JSON strings with a custom prefix"</p>
<p>And un-check that option.</p>
<p>If this does not work you are able to switch off prefixing using the application.cfc or in your cfc.&#160; This I have never done but Ray Camden has a post on this.</p>
<p>Other than that... don&#39;t forget that CF only prefixes with JS code not written by CF.&#160; To put simply, if you used CFajaxProxy to call your CF ajax generator then that would work without having to turn off the function in the administrator.</p>
<p>Sorry if you already knew all this but it&#39;s as far as my knowledge stretches.&#160; Good luck.</p>
</p>
<p>regards</p>
<p>Ken.</p></p>
]]></description>
        	        	<pubDate>Fri, 29 Jul 2011 00:16:40 +0300</pubDate>
        </item>
        <item>
        	<title>gfrobenius on "Prefix serialized JSON with" setting in ColdFusion</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/prefix-serialized-json-with-setting-in-coldfusion#p24086</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/prefix-serialized-json-with-setting-in-coldfusion#p24086</guid>
        	        	<description><![CDATA[<p>Thanks for your reply but that will not work. &#160;(I can also supply my version of the ColdFusion backend if you want it, email me, <a href="mailto:gordon@psasys.com" target="_blank">gordon@psasys.com</a>) &#160;Let me see if I can better explain. &#160;Your suggestion above was to use ColdFusion mid to simply remove the leading character, but ColdFusion is not in play at all at the point where the problem lies. &#160;The grid makes a request to my cfc function, that cfc function does a query, turns the rows into json rows that the jqGrid is expecting, and returns that. &#160;When ColdFusion returns that json string is contains some leading charaters that I need to be able to strip out using CLIENT SIDE JQGRID JAVASCRIPT CODE. &#160;ColdFusion talking to ColdFusion there is no problem (meaning using ColdFusions SerializeJSON and DeserializeJSON). &#160;Doing it that way CF knows to automatically add the leading characters and remove the leading characters, you don&#39;t need to do anything. &#160;But in my case its not CF talking to CF, its jqGrid (javaScript ajax) talking to CF. &#160;So CF is putting the leading characters on the JSON string and I need to know how to remove them using some kind of a jqGrid hook. &#160;I guess I&#39;m hoping for an event between events 3 and 4...</p>
<p>Execution order of jqGrid Events...</p>
<div class="level2">
<ol>
<li class="level1">
<div class="li">beforeRequest</div>
</li>
<li class="level1">
<div class="li">loadBeforeSend</div>
</li>
<li class="level1">
<div class="li">serializeGridData</div>
</li>
<li class="level1">
<div class="li">loadError (if a error from the request occur - the event 5 and 6  do not execute. If there is no error the event 4. does not execute and we  continue to with 5. and 6.)</div>
</li>
<li class="level1">
<div class="li">gridComplete</div>
</li>
<li class="level1">
<div class="li">loadComplete</div>
</li>
</ol>
</div>
]]></description>
        	        	<pubDate>Thu, 28 Jul 2011 18:06:23 +0300</pubDate>
        </item>
        <item>
        	<title>Ken on "Prefix serialized JSON with" setting in ColdFusion</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/prefix-serialized-json-with-setting-in-coldfusion#p24082</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/prefix-serialized-json-with-setting-in-coldfusion#p24082</guid>
        	        	<description><![CDATA[<blockquote>
<p>gfrobenius said:</p>
<p>I am using jqgrid with ColdFusion, and it works great. Just have one issue I can&#39;t seem to figure out. I&#39;m using the "Prefix serialized JSON with" setting in ColdFusion. (See <a class="urlextern" title="http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-750b.html" rel="nofollow" href="http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-750b.html" target="_blank"></a><a href="http://help.adobe.com/en_US/Co" rel="nofollow" target="_blank">http://help.adobe.com/en_US/Co</a>.....-750b.html the secureJSON and secureJSONPrefix options) Here&#39;s another a link that talks about it <a class="urlextern" title="http://www.petefreitag.com/item/720.cfm" rel="nofollow" href="http://www.petefreitag.com/item/720.cfm" target="_blank">http://www.petefreitag.com/item/720.cfm</a>.</p>
<p>It basically just adds some characters to beginning of the JSON string that is sent back like this&#8230;</p>
</p>
<p>//{&#8220;rows&#8221;:[{&#8220;cell&#8221;:[&#8221;&#8221;,10000228637555,&#8221;ACSN&#8221;,&#8221;444657#002&#8221;,&#8221;&#8221;,&#8221;OPEN&#8221;,&#8221;GFHGVKJLM&#8221;],&#8221;ID&#8221;:10000228637555},{&#8220;cell&#8221;:[etc...</p>
</p>
<p>Notice the leading //. My question is, is there a way I can manipulate the response before it tries to act on it so I do not receive parseerror?&#160; I just want to be able to remove the first [X] number of charaters from the response.</p>
</blockquote>
<hr />
<p align="left">&#160;Hi</p>
<p align="left">&#160;</p>
<p align="left">If you simply need to remove the // can you try:</p>
<p align="left">&#160;</p>
<p><input type='button' class='sfcodeselect' name='sfselectit2454' value='Select Code' data-codeid='sfcode2454' /></p>
<div class='sfcode' id='sfcode2454'>
<p>serializeJson( Mid( yourAjaxString , 2 , len(yourAjaxString) )) ;</p>
</div>
<p align="left">&#160;</p>
<p align="left">I have also posted the function that I use to generate my data for each grid.&#160;&#160; I use this on many grids and it&#39;s kinda grown over the years but you can always chop out what you don need.</p>
<p align="left">&#160;</p>
<p align="left">Regards Ken,</p>
<p align="left">&#160;</p>
<p align="left">&#160;(sorry about the formatting but if you paste into eclipse it will be nice and neat, I promise) <img class="wp-smiley" src="/blog/wp-includes/images/smilies/icon_smile.gif" alt=":)" /> &#160;</p>
<p align="left">&#160;</p>
<p align="left">&#160;</p>
<p><input type='button' class='sfcodeselect' name='sfselectit537' value='Select Code' data-codeid='sfcode537' /></p>
<div class='sfcode' id='sfcode537'>
<div class=&#34;sfcode&#60;cffunction name=&#34;>
<p align=&#34;left&#34;>&#60;cffunction</p>
<p>name=&#34;fnt_displayStaffDataGrid&#34; access=&#34;private&#34; output=&#34;true&#34;&#62;</p>
<p align=&#34;left&#34;>&#160;</p>
<p>&#60;cfargument name=&#34;staffData&#34; required=&#34;true&#34; type=&#34;Any&#34; /&#62;</p>
<p align=&#34;left&#34;>&#160;</p>
<p>&#60;cfargument name=&#34;structArg&#34; required=&#34;true&#34; type=&#34;struct&#34; /&#62;</p>
<p align=&#34;left&#34;>&#160;</p>
<p align=&#34;left&#34;>&#160;</p>
<p>&#60;cfsilent&#62;&#60;cfsetting showdebugoutput=&#34;false&#34; /&#62;</p>
<p align=&#34;left&#34;>&#160;</p>
<p align=&#34;left&#34;>&#160;</p>
<p>&#60;cfscript&#62;</p>
<p align=&#34;left&#34;>// define the local scope</p>
<p align=&#34;left&#34;>local = {</p>
<p align=&#34;left&#34;>&#160;</p>
<p align=&#34;left&#34;>// count the data rows passed across</p>
<p align=&#34;left&#34;>dataCount = arguments.staffData.recordCount</p>
<p align=&#34;left&#34;>&#160;</p>
<p align=&#34;left&#34;>//create the looping counter</p>
<p align=&#34;left&#34;>,cnt_data =</p>
<p>0</p>
<p align=&#34;left&#34;>&#160;</p>
<p align=&#34;left&#34;>// create the image paths and strings</p>
<p align=&#34;left&#34;>,openImgText =</p>
<p align=&#34;left&#34;>,closeImgText =</p>
<p>lCase(&#39;&#60;img src=&#34;..#application.clientSys#mediaimagesicons&#39;)&#39;.png&#34; class=&#34;profilePicture&#34;&#62;&#39;</p>
<p align=&#34;left&#34;>&#160;</p>
<p align=&#34;left&#34;>,str_imagePath =</p>
<p>&#39;&#39;</p>
<p align=&#34;left&#34;>&#160;</p>
<p align=&#34;left&#34;>,str_maleProfile =</p>
<p>&#39;profile_male&#39;</p>
<p align=&#34;left&#34;>,str_femaleProfile =</p>
<p>&#39;profile_female&#39;</p>
<p align=&#34;left&#34;>&#160;</p>
<p align=&#34;left&#34;>,list_maleGender =</p>
<p>&#39;Mr,Sir&#39;</p>
<p align=&#34;left&#34;>&#160;</p>
<p align=&#34;left&#34;>};</p>
<p align=&#34;left&#34;>&#160;</p>
<p align=&#34;left&#34;>// declare the structure to contain the results</p>
<p align=&#34;left&#34;>local.result = {};</p>
<p align=&#34;left&#34;>&#160;</p>
<p align=&#34;left&#34;>local.result[</p>
<p align=&#34;left&#34;>&#160;</p>
<p align=&#34;left&#34;>// local.result[&#39;rows&#39;] = []; &#60;&#8212; this does not work here and I don&#39;t have a clue why ???? it works everywhere else&#8230;.</p>
<p align=&#34;left&#34;>&#160;</p>
<p align=&#34;left&#34;>// add the page details to result</p>
<p align=&#34;left&#34;>local.result[</p>
<p align=&#34;left&#34;>local.result[</p>
<p align=&#34;left&#34;>local.result[</p>
<p align=&#34;left&#34;>&#160;</p>
<p align=&#34;left&#34;>// loop over the data and create the jSon values</p>
<p align=&#34;left&#34;>&#160;</p>
<p align=&#34;left&#34;>local.cnt_data = local.cnt_data +</p>
<p align=&#34;left&#34;>&#160;</p>
<p align=&#34;left&#34;>// define the temporay holder for the jSon data</p>
<p align=&#34;left&#34;>local.row = {};</p>
<p align=&#34;left&#34;>&#160;</p>
<p align=&#34;left&#34;>// create the row and give it a unique ID.</p>
<p align=&#34;left&#34;>local.row[</p>
<p align=&#34;left&#34;>&#160;</p>
<p align=&#34;left&#34;>// create an array to hold the cell information</p>
<p align=&#34;left&#34;>local.row[</p>
<p align=&#34;left&#34;>&#160;</p>
<p align=&#34;left&#34;>// select the image profile</p>
<p align=&#34;left&#34;>&#160;</p>
<p align=&#34;left&#34;>&#160;</p>
<p align=&#34;left&#34;>local.str_imagePath = local.openImgText &#38; local.str_femaleProfile &#38; local.closeImgText;</p>
<p align=&#34;left&#34;>&#160;</p>
<p align=&#34;left&#34;>}</p>
<p align=&#34;left&#34;>&#160;</p>
<p align=&#34;left&#34;>local.str_imagePath = local.openImgText &#38; local.str_maleProfile &#38; local.closeImgText;</p>
<p align=&#34;left&#34;>&#160;</p>
<p align=&#34;left&#34;>};</p>
<p align=&#34;left&#34;>&#160;</p>
<p align=&#34;left&#34;>&#160;</p>
<p align=&#34;left&#34;>// populate the cells with the required information ** removed - local.str_imagePath &#38; &#39; &#39; &#38;</p>
<p align=&#34;left&#34;>// ************************************************</p>
<p align=&#34;left&#34;>&#160;</p>
<p align=&#34;left&#34;>&#160;</p>
<p align=&#34;left&#34;>&#160;</p>
<p align=&#34;left&#34;>&#160;</p>
<p align=&#34;left&#34;>// ************************************************</p>
<p align=&#34;left&#34;>&#160;</p>
<p align=&#34;left&#34;>// add the row to the results</p>
<p align=&#34;left&#34;>&#160;</p>
<p align=&#34;left&#34;>}</p>
<p align=&#34;left&#34;>&#160;</p>
<p align=&#34;left&#34;>//cfdrop(serializeJson(local.result));</p>
<p align=&#34;left&#34;>&#160;</p>
<p align=&#34;left&#34;>&#160;</p>
<p>&#39;rows&#39;] = arrayNew(1);&#39;page&#39;] = javaCast( &#39;int&#39;, arguments.structArg.pageNumber );&#39;records&#39;] = javaCast( &#39;int&#39;, arguments.structArg.totalRecords );&#39;total&#39;] = javaCast( &#39;int&#39;, arguments.structArg.totalPages );while ( local.cnt_data &#60; local.dataCount ) {1;&#39;id&#39;] = arguments.staffData.staffID[local.cnt_data];&#39;cell&#39;] = [];if ( listFindNoCase( local.list_maleGender, trim(arguments.staffData.staff_title[local.cnt_data]) ) == 0 ) {else {arrayAppend( local.row[&#39;cell&#39;], trim(arguments.staffData.staffID[local.cnt_data]) );arrayAppend( local.row[&#39;cell&#39;], trim(arguments.staffData.staff_firstName[local.cnt_data]) );arrayAppend( local.row[&#39;cell&#39;], trim(arguments.staffData.staff_surname[local.cnt_data]) ); arrayAppend( local.result[&#39;rows&#39;], local.row );&#60;/cfscript&#62;</p>
<p align=&#34;left&#34;>&#160;</p>
<p align=&#34;left&#34;>ã€€</p>
<p align=&#34;left&#34;>&#160;</p>
<p>&#60;/cfsilent&#62;&#60;cfoutput&#62;#serializeJson(local.result)#&#60;/cfoutput&#62;&#60;cfabort&#62; <br />&#60;/cffunction&#62;</p>
</div>
</div>
]]></description>
        	        	<pubDate>Thu, 28 Jul 2011 14:48:48 +0300</pubDate>
        </item>
        <item>
        	<title>gfrobenius on "Prefix serialized JSON with" setting in ColdFusion</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/prefix-serialized-json-with-setting-in-coldfusion#p24056</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/prefix-serialized-json-with-setting-in-coldfusion#p24056</guid>
        	        	<description><![CDATA[<p>I am using jqgrid with ColdFusion, and it works great. Just have one issue I can&#39;t seem to figure out. I&#39;m using the "Prefix serialized JSON with" setting in ColdFusion. (See <a class="urlextern" title="http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-750b.html" rel="nofollow" href="http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-750b.html" target="_blank"></a><a href="http://help.adobe.com/en_US/Co" rel="nofollow" target="_blank">http://help.adobe.com/en_US/Co</a>.....-750b.html the secureJSON and secureJSONPrefix options) Here&#39;s another a link that talks about it <a class="urlextern" title="http://www.petefreitag.com/item/720.cfm" rel="nofollow" href="http://www.petefreitag.com/item/720.cfm" target="_blank">http://www.petefreitag.com/item/720.cfm</a>.</p>
<p>It basically just adds some characters to beginning of the JSON string that is sent back like this...</p>
</p>
<p>//{&#8220;rows&#8221;:[{&#8220;cell&#8221;:[&#8221;&#8221;,10000228637555,&#8221;ACSN&#8221;,&#8221;444657#002&#8221;,&#8221;&#8221;,&#8221;OPEN&#8221;,&#8221;GFHGVKJLM&#8221;],&#8221;ID&#8221;:10000228637555},{&#8220;cell&#8221;:[etc...</p>
</p>
<p>Notice the leading //. My question is, is there a way I can manipulate the response before it tries to act on it so I do not receive parseerror?&#160; I just want to be able to remove the first [X] number of charaters from the response.</p>
]]></description>
        	        	<pubDate>Mon, 25 Jul 2011 16:35:32 +0300</pubDate>
        </item>
</channel>
</rss>