<?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 - jsonstring, how to insert in grid</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/json-jsonstring-how-to-insert-in-grid</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-jsonstring-how-to-insert-in-grid/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>johannesynt on JSON - jsonstring, how to insert in grid</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/json-jsonstring-how-to-insert-in-grid#p26367</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/json-jsonstring-how-to-insert-in-grid#p26367</guid>
        	        	<description><![CDATA[<p>Hi! I&#39;m not american, so excuse me for the syntax...I have a problem: I don&#39; t understand how to insert data in my grid:</p>
<p>I have a php program; when I call it, it send me a json file, in string format, with a ECHO.</p>
<p>I don&#39;t understand how I can set parameters of JSONREADER function of jqgrid..</p>
<p>The grid apperas in html page, but it&#39;s empty.</p>
<p>I post the code:</p>
<p><span style="text-decoration: underline;"><strong>PHP:</strong></span></p>
<p><span style="color: #0000ff;"><span style="color: #000000;">&#60;?php</span><br />$<span style="color: #800080;">jsstring</span><span style="color: #000000;">= </span>&#39;{<br />&#160;&#160; &#160;&#160;&#160; &#160;"shops":{<br />&#160;&#160; &#160;&#160;&#160; &#160;<br />&#160;&#160; &#160;&#160;&#160; &#160;"shop1":{<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;"name": "Market FK",<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;"address": "Farini street",<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;"num": "92838390"<br />&#160;&#160; &#160;&#160;&#160; &#160;},<br />&#160;&#160; &#160;&#160;&#160; &#160;<br />&#160;&#160; &#160;&#160;&#160; &#160;"shop2":{<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;"name": "Fruit Yeah",<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;"address": "Plaza Tree",<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;"num": "4434886"<br />&#160;&#160; &#160;&#160;&#160; &#160;}<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;}<br />}&#39;<span style="color: #000000;">;<br />echo</span> <span style="color: #800080;">$jsstring</span><span style="color: #000000;">;</span></span>&#160;&#160;&#160; ?&#62;</p>
<p>THIS JSON FILE IS NOT AN ARRAY. I DON&#39;T KNOW IF AN ARRAY JSON FILE IS BETTER, BUT <strong><span style="color: #000000;">I CAN&#39;T</span></strong> CHANGE THE JSON FILE!!!</p>
<p><span style="text-decoration: underline;"><strong>JAVASCRIPT:</strong></span></p>
<p><span style="color: #ff0000;">$(document).ready(function() {&#160;&#160; &#160;<br />$("#<span style="color: #339966;">i</span><span style="color: #339966;">d_table</span><span style="color: #339966;">&#160;</span>").jqGrid({&#160;&#160;&#160; &#160;&#160;&#160; &#160;url:"<span style="color: #339966;">url of php file</span>", <br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;datatype: "jsonstring",&#160;&#160; <span style="color: #0000ff;">//is it correct??</span><br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;mtype: "GET",<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;colNames:["Name","Address", "Tel number"], <br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;colModel:[ &#160;&#160; &#160;{name:&#39;name&#39;,index:&#39;name&#39;, width:100}, </span><span style="color: #0000ff;">//is it correct??</span><br /><span style="color: #ff0000;">&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;{name:&#39;address&#39;,index:&#39;address&#39;, width:120}, <br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;{name:&#39;tel&#39;,index:&#39;tel&#39;, width:100} <br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;], <br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;jsonReader : {</span><br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160; <span style="color: #3cc53a;">HERE I DON&#39;T KNOW HOW TO SET</span><br />&#160; &#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;<span style="color: #ff0000;">} <br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;}); &#160;&#160; &#160;<br />});</span></p>
<p><span style="color: #000000;">I WANT TO HAVE A GRID WITH:</span></p>
<p><span style="color: #000000;">first column: the names of the shop</span></p>
<p><span style="color: #000000;">second column: the address</span></p>
<p><span style="color: #000000;">third colum: tel numbers</span></p>
</p>
<p><span style="color: #000000;">So a grid like this:</span></p>
<ul>
<li><span style="color: #000000;">Market FK&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Farini street&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160; </span>92838390</li>
<li><span style="color: #000000;">Fruit Yeah &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Plaza Tree&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>4434886</li>
</ul>
<p>THANK YOU VERY MUCH</p>
]]></description>
        	        	<pubDate>Sat, 14 Apr 2012 13:37:00 +0300</pubDate>
        </item>
</channel>
</rss>