<?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: Invalid Json when using exporting a Grid with events defined</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/invalid-json-when-using-exporting-a-grid-with-events-defined</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/invalid-json-when-using-exporting-a-grid-with-events-defined/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>john on Invalid Json when using exporting a Grid with events defined</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/invalid-json-when-using-exporting-a-grid-with-events-defined#p23395</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/invalid-json-when-using-exporting-a-grid-with-events-defined#p23395</guid>
        	        	<description><![CDATA[<p>i should add, i use firebug to show me the layout of the json data being sent to the server. then for each event i note the name of the event and the name of the following event in the JSON and replace it as shown in the java sample.</p>
]]></description>
        	        	<pubDate>Mon, 30 May 2011 17:37:27 +0300</pubDate>
        </item>
        <item>
        	<title>john on Invalid Json when using exporting a Grid with events defined</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/invalid-json-when-using-exporting-a-grid-with-events-defined#p23394</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/invalid-json-when-using-exporting-a-grid-with-events-defined#p23394</guid>
        	        	<description><![CDATA[<p>No, i had to work arround it. when i save the grid i have to first edit it in the java service code to remove all events before saving it to the database.</p>
<p>The code i use to do that is as follows</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit1580' value='Select Code' data-codeid='sfcode1580' /></p>
<div class='sfcode' id='sfcode1580'>
<p>public void saveGrid(String grid, String user, String report) {</p>
<p>System.out.println(&#34;&#62;&#62;&#62;GridServiceImpl.saveGrid&#34;);</p>
</p>
<p>// strip out all grid events (e.g. onSelectRow, onPaging, gridComplete</p>
<p>int i = grid.indexOf(&#34;onSelectRow&#34;);</p>
<p>int j = grid.indexOf(&#34;onSortCol&#34;) - 1;</p>
<p>grid = grid.substring(0, i) + &#34;onSelectRow\&#34;:null,&#34; + grid.substring(j) ;</p>
<p>i = grid.indexOf(&#34;onPaging&#34;);</p>
<p>j = grid.indexOf(&#34;onSelectAll&#34;) - 1;</p>
<p>grid = grid.substring(0, i) + &#34;onPaging\&#34;:null,&#34; + grid.substring(j) ;</p>
<p>i = grid.indexOf(&#34;gridComplete&#34;);</p>
<p>j = grid.indexOf(&#34;loadError&#34;) - 1;</p>
<p>grid = grid.substring(0, i) + &#34;gridComplete\&#34;:null,&#34; + grid.substring(j) ;</p>
</p>
<p>System.out.println(grid);</p>
<p>try {</p>
<p>Model.perform(&#34;saveGrid&#34;, new Object[] {user, report, grid });</p>
<p>} catch (Exception e) {</p>
<p>e.printStackTrace();</p>
<p>}</p>
<p>}</p>
</div>
<p>&#160;Then in my javascript i reload the events after the jqGridImport function</p>
<p><input type='button' class='sfcodeselect' name='sfselectit1666' value='Select Code' data-codeid='sfcode1666' /></p>
<div class='sfcode' id='sfcode1666'>
<p>jQuery(&#39;#tableReport&#39;).jqGrid(&#39;setGridParam&#39;, { &#39;onPaging&#39;:function(btn){</p>
<p>$(&#34;#tableReport&#34;).appendPostData({refresh:false});</p>
<p>var vSelectedIds;</p>
<p>vSelectedIds = $(&#34;#tableReport&#34;).getGridParam(&#39;selarrrow&#39;);</p>
<p>$(&#34;#tableReport&#34;).appendPostData({ticked:vSelectedIds});</p>
<p>}});</p>
</div>
<p>hope that helps.</p>
<p>john&#160;</p></p>
]]></description>
        	        	<pubDate>Mon, 30 May 2011 17:34:15 +0300</pubDate>
        </item>
        <item>
        	<title>rui.isidro@gmail.com on Invalid Json when using exporting a Grid with events defined</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/invalid-json-when-using-exporting-a-grid-with-events-defined#p23391</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/invalid-json-when-using-exporting-a-grid-with-events-defined#p23391</guid>
        	        	<description><![CDATA[<p>Did you find any other solution? I&#39;m also having problems with this. I have a few events attached to a grid and I whant to export the grid, but I always get errors with JSON because of the deveined event handler functions.</p>
]]></description>
        	        	<pubDate>Mon, 30 May 2011 16:43:20 +0300</pubDate>
        </item>
        <item>
        	<title>john on Invalid Json when using exporting a Grid with events defined</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/invalid-json-when-using-exporting-a-grid-with-events-defined#p20640</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/invalid-json-when-using-exporting-a-grid-with-events-defined#p20640</guid>
        	        	<description><![CDATA[<p>i have a grid which has actions defined for the onPaging, onSelectRow and gridComplete events</p>
<p>When i use the jqGridExport function to export the grid to the server it seems to work OK, but when i run the JSON that it creates through JSONLint it says the JSON is invalid for these actions.</p>
<p>My jqGridExport command is:</p>
<p><input type='button' class='sfcodeselect' name='sfselectit6665' value='Select Code' data-codeid='sfcode6665' /></p>
<div class='sfcode' id='sfcode6665'>
<p>var jsonGrid = jQuery(&#34;#tableReport&#34;).jqGridExport({exptype: &#34;jsonstring&#34;, root: &#34;tableReport&#34;});</p>
<p>$.post(&#34;/SOA/Grid.soa&#34;, {grid: jsonGrid, report: &#34;today&#34;});</p>
</div>
<p>The code for my onSelectRow event is:</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit8798' value='Select Code' data-codeid='sfcode8798' /></p>
<div class='sfcode' id='sfcode8798'>&#160;&#160; &#160;&#160;&#160;&#160; onSelectRow: function(id){<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;if(id &#38;&#38; id!==lastRow){<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;$(&#34;#tableReport&#34;).saveRow(lastRow, false);<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;$(&#34;#tableReport&#34;).editRow(id,true);<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;lastRow=id;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;}<br />&#160;&#160; &#160;&#160;&#160; &#160;}</div>
</p>
<p>The JSON created is:</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit916' value='Select Code' data-codeid='sfcode916' /></p>
<div class='sfcode' id='sfcode916'>&#160;&#160;&#160;&#160;&#160;&#160; &#8230;..<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#34;beforeSelectRow&#34;: null,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#34;onSelectRow&#34;: function (id) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (id &#38;&#38; id !== lastRow) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $(&#34;#tableReport&#34;).saveRow(lastRow,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; false); $(&#34;#tableReport&#34;).editRow(id,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; true); lastRow = id; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; },<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#34;onSortCol&#34;: null,<br />&#160;&#160;&#160;&#160;&#160;&#160; &#8230;&#8230;.</div>
</p>
<p>The JSONLint message is: &#39;syntax error, unexpeted TINVALID at line nnn&#39;</p>
<p> Just a thought, could it be because i am in Belgium? i know that in some applications i need to use semicolons as value delimiters in lists</p>
<p>i have resolved this by making my Server code strip out the event methods. Then in my jqGridImport call i re-add them.</p></p>
]]></description>
        	        	<pubDate>Wed, 03 Nov 2010 11:42:30 +0200</pubDate>
        </item>
</channel>
</rss>