<?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: JSON -custom datatype function - addJSONdata </title>
	<link>http://www.trirand.com/blog/?page_id=393/help/json-custom-datatype-function-addjsondata</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/json-custom-datatype-function-addjsondata/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>stefan-t on JSON -custom datatype function - addJSONdata </title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/json-custom-datatype-function-addjsondata#p5963</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/json-custom-datatype-function-addjsondata#p5963</guid>
        	        	<description><![CDATA[<p>I found a workaround to my problem :</p>
<p>I downloaded a javascript function equivalent to php</p>
<p>json_encode&#160;&#160;&#160; from this site</p>
<p><a href="http://www.bloggapedia.com/blog_post.php?p=Javascript-equivalent-for-b-PHP-b-s-json-decode-818598" rel="nofollow" target="_blank"><a href="http://www.bloggapedia.com/blo" rel="nofollow">http://www.bloggapedia.com/blo</a>.....ode-818598</a></p>
<p>Then&#160;&#160; with&#160; jsondata.responseText</p>
<p>1. &#160; var tmp = eval(&#39;(&#39; + jsondata.responseText + &#39;)&#39;);</p>
<p>2.&#160;&#160;&#160; var myObject = json_decode(tmp.d);</p>
<p>3.&#160;&#160;&#160;&#160; thegrid.addJSONData(myObject);&#160;&#160;&#160;&#160; // Works O.K</p>
<p>It is a workaround.</p>
<p>What other can I do ?</p>
<p>Regards</p>
<p>Stefan</p></p>
]]></description>
        	        	<pubDate>Sun, 12 Apr 2009 22:32:50 +0300</pubDate>
        </item>
        <item>
        	<title>stefan-t on JSON -custom datatype function - addJSONdata </title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/json-custom-datatype-function-addjsondata#p5955</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/json-custom-datatype-function-addjsondata#p5955</guid>
        	        	<description><![CDATA[<p>&#160;thegrid.addJSONData(eval("(" + jsondata.responseText + ")").d);Hi,</p>
<p>Thanks for your excellent work .</p>
<p>I tried one full&#160; workday&#160; to solve the follow problem without success.</p>
<p>(jqGrid 3.5a alpha 2 -&#160;&#160; asp.net C# 2008 - JSON.Net object serializer).</p>
<p>I&#160; do a ajax call to asp.net page method</p>
<p>and&#160; return the jsondata&#160; ( formatted through JSON.Net).</p>
<p>Then I call</p>
<p>thegrid.addJSONData( eval("(" + jsondata.responseText + ")"));&#160;</p>
<p>but&#160; your function inside can&#39;t understand the data[].</p>
<p>if I&#160; construct the object in javascript&#160; then&#160; it works.</p>
<p>example:</p>
<p>&#160;var myJSONObject2 = { "d": { "page": "2", "totals": "15", "records": "150", "rows": [<br />&#160;&#160;&#160; { "cell": ["ircEvent", "PRIVMSG", "method", "newURI", "regex"], "id": "1" },<br />&#160;&#160;&#160; { "cell": ["ircEvent", "PRIVMSG", "method", "newURI", "regex"], "id": "2" },</p>
<p>&#160;&#160; { "cell": ["ircEvent", "PRIVMSG", "method", "newURI", "regex"], "id": "3" },</p>
<p>&#160;&#160; { "cell": ["ircEvent", "PRIVMSG", "method", "newURI", "regex"], "id": "4" },</p>
<p>&#160;&#160;&#160; { "cell": ["ircEvent", "PRIVMSG", "method", "newURI", "regex"], "id": "5"}</p>
<p>]&#160; } };</p>
<p>&#160;thegrid.addJSONData(myJSONObject.d);&#160;&#160;&#160; /*&#160; O.K&#160; !!! */</p>
<p>-------------------------------------------------------------------------------------</p>
<p>Now&#160; the&#160; jsondata.responseText&#160; is formatted&#160; like this:</p>
<p>{"total":"15","page":"1","records":"150","rows":[</p>
<p>{"id":"1","cell":["1","image","Chief Scout","Highest Award test","0"]},{"id":"2","cell":["2","image","Chief Scout","Highest Award test","0"]},{"id":"3","cell":["3","image","Chief Scout","Highest Award test","0"]},{"id":"4","cell":["4","image","Chief Scout","Highest Award test","0"]},{"id":"5","cell":["5","image","Chief Scout","Highest Award test","0"]},{"id":"6","cell":["6","image","Chief Scout","Highest Award test","0"]},{"id":"7","cell":["7","image","Chief Scout","Highest Award test","0"]},{"id":"8","cell":["8","image","Chief Scout","Highest Award test","0"]},{"id":"9","cell":["9","image","Chief Scout","Highest Award test","0"]},{"id":"10","cell":["10","image","Chief Scout","Highest Award test","0"]}</p>
<p>]}</p>
<p>thegrid.addJSONData(eval("(" + jsondata.responseText + ")"));&#160;&#160;</p>
<p>/*&#160; Failed&#160; */</p>
<p>I can&#39;t see&#160; any difference in the format&#160; of the first JSON object.</p>
<p>except that the .net debugger shows the first object as structured JsonObject.</p>
<p>The jsondata.responseText is&#160; string.</p>
<p>I tried also</p>
<p>&#160; var s = eval("(" + jsondata.responseText + ")");</p>
<p>&#160;&#160; var&#160; s1 = { &#39;d&#39;: s };</p>
<p>&#160;&#160; thegrid.addJSONData(s1.d);</p>
<p>without success.</p>
<p>Can you help me ?</p>
<p>Regards.</p>
<p>Stefan</p>
]]></description>
        	        	<pubDate>Sat, 11 Apr 2009 20:11:40 +0300</pubDate>
        </item>
</channel>
</rss>