<?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: autodetection of input JSON format</title>
	<link>http://www.trirand.com/blog/?page_id=393/feature-request/autodetection-of-input-json-format</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/feature-request/autodetection-of-input-json-format/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>tony on autodetection of input JSON format</title>
        	<link>http://www.trirand.com/blog/?page_id=393/feature-request/autodetection-of-input-json-format#p28508</link>
        	<category>Feature Request</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/feature-request/autodetection-of-input-json-format#p28508</guid>
        	        	<description><![CDATA[<p>Thanks Oleg,</p>
<p>I will check this during the weekend.</p>
</p>
<p>Best Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Fri, 22 Mar 2013 17:00:04 +0200</pubDate>
        </item>
        <item>
        	<title>OlegK on autodetection of input JSON format</title>
        	<link>http://www.trirand.com/blog/?page_id=393/feature-request/autodetection-of-input-json-format#p28505</link>
        	<category>Feature Request</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/feature-request/autodetection-of-input-json-format#p28505</guid>
        	        	<description><![CDATA[<p>Hello Tony,</p>
<p>I posted suggested changes as <a href="https://github.com/tonytomov/jqGrid/pull/439" target="_blank">the pull request</a>.</p>
<p>Best regards<br />Oleg&#160;</p>
]]></description>
        	        	<pubDate>Fri, 22 Mar 2013 14:00:50 +0200</pubDate>
        </item>
        <item>
        	<title>OlegK on autodetection of input JSON format</title>
        	<link>http://www.trirand.com/blog/?page_id=393/feature-request/autodetection-of-input-json-format#p28404</link>
        	<category>Feature Request</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/feature-request/autodetection-of-input-json-format#p28404</guid>
        	        	<description><![CDATA[<p>Hello Tony,</p>
<p>to be more specific I made some relatively simple modification of <em>jquery.jqGrid.src.js</em> which you can find <a href="http://www.ok-soft-gmbh.com/jqGrid/jquery.jqGrid-4.4.4/js/jquery.jqGrid.src-dynamicReader.js" target="_blank">here</a>. It is not final code and I modified only code of <strong>addJSONData</strong>, but it shows how the implementation could be. All the following demos use almost the same code</p>
<p><input type='button' class='sfcodeselect' name='sfselectit3091' value='Select Code' data-codeid='sfcode3091' /></p>
<div class='sfcode' id='sfcode3091'>$(&#39;#list&#39;).jqGrid({<br />&#160; &#160; url: &#39;Dynamic<strong>0</strong>.json&#39;,<br />&#160; &#160; datatype: &#39;json&#39;,<br />&#160; &#160; colNames: [&#39;Name&#39;, &#39;Street&#39;, &#39;City&#39;, &#39;Id&#39;],<br />&#160; &#160; colModel: [<br />&#160; &#160; &#160; &#160; { name: &#39;Id&#39;, width: 55, align: &#39;center&#39;, key: true},<br />&#160; &#160; &#160; &#160; { name: &#39;Name&#39;, width: 120 },<br />&#160; &#160; &#160; &#160; { name: &#39;Street&#39;, width: 190 },<br />&#160; &#160; &#160; &#160; { name: &#39;City&#39;, width: 90 }<br />&#160; &#160; ],<br />&#160; &#160; height: &#34;auto&#34;,<br />&#160; &#160; gridview: true<br />});&#160;</div>
<p>where only the url parameter will be changed from &#39;Dynamic0.json&#39; till &#39;Dynamic4.json&#39;. How you can see there (<a href="http://www.ok-soft-gmbh.com/jqGrid/dynamicReader/DynamicReader0.htm" target="_blank">demo0</a>, <a href="http://www.ok-soft-gmbh.com/jqGrid/dynamicReader/DynamicReader1.htm" target="_blank">demo1</a>, <a href="http://www.ok-soft-gmbh.com/jqGrid/dynamicReader/DynamicReader2.htm" target="_blank">demo2</a>, <a href="http://www.ok-soft-gmbh.com/jqGrid/dynamicReader/DynamicReader3.htm" target="_blank">demo3</a>, <a href="http://www.ok-soft-gmbh.com/jqGrid/dynamicReader/DynamicReader4.htm" target="_blank">demo4</a>) are no <strong>jsonReader</strong> parameter in the grid, but all different JSON data will be successfully read and displayed.</p>
<p><em>Dynamic0.json</em>: (standard JSON)</p>
<p><input type='button' class='sfcodeselect' name='sfselectit5430' value='Select Code' data-codeid='sfcode5430' /></p>
<div class='sfcode' id='sfcode5430'>{&#34;page&#34;:1,<br />&#34;total&#34;:37,<br />&#34;records&#34;:722,<br />&#34;rows&#34;:<br />[<br />&#160; &#160; {&#34;id&#34;:1,&#34;cell&#34;:[1, &#34;Sample name 1&#34;,&#34;Sample Street 2&#34;,&#34;Sample City 3&#34;]},<br />&#160; &#160; {&#34;id&#34;:2,&#34;cell&#34;:[2, &#34;Sample name 2&#34;,&#34;Sample Street 2&#34;,&#34;Sample City 3&#34;]}<br />]<br />}&#160;</div>
<p><em>Dynamic1.json</em>: (JSON which typically require <strong>jsonReader: {cell: ""}</strong>)</p>
<p><input type='button' class='sfcodeselect' name='sfselectit2790' value='Select Code' data-codeid='sfcode2790' /></p>
<div class='sfcode' id='sfcode2790'>{&#34;page&#34;:1,<br />&#34;total&#34;:37,<br />&#34;records&#34;:722,<br />&#34;rows&#34;:<br />[<br />&#160; &#160; [1, &#34;Sample name 1&#34;,&#34;Sample Street 2&#34;,&#34;Sample City 3&#34;],<br />&#160; &#160; [2, &#34;Sample name 2&#34;,&#34;Sample Street 2&#34;,&#34;Sample City 3&#34;]<br />]<br />}&#160;</div>
<p><em></em></p>
<p style="display: inline !important;"><em>Dynamic2.json</em><em>: </em>(JSON which typically require&#160;<strong>jsonReader: {cell: "", root: function (obj) {return obj;}}</strong>)</p>
<p><em></em></p>
<p><input type='button' class='sfcodeselect' name='sfselectit6630' value='Select Code' data-codeid='sfcode6630' /></p>
<div class='sfcode' id='sfcode6630'>[<br />&#160; &#160; [1, &#34;Sample name 1&#34;,&#34;Sample Street 2&#34;,&#34;Sample City 3&#34;],<br />&#160; &#160; [2, &#34;Sample name 2&#34;,&#34;Sample Street 2&#34;,&#34;Sample City 3&#34;]<br />]</div>
<p><em>Dynamic3.json</em>: (JSON which typically require <strong>jsonReader: {repeatitems: false, root: function (obj) {return obj;}}</strong>) </p>
<p><input type='button' class='sfcodeselect' name='sfselectit510' value='Select Code' data-codeid='sfcode510' /></p>
<div class='sfcode' id='sfcode510'>[<br />&#160; &#160; {&#34;Id&#34;:1, &#34;Name&#34;:&#34;Sample name 1&#34;, &#34;Street&#34;:&#34;Sample Street 2&#34;, &#34;City&#34;:&#34;Sample City 3&#34;},<br />&#160; &#160; {&#34;Id&#34;:2, &#34;Name&#34;:&#34;Sample name 2&#34;, &#34;Street&#34;:&#34;Sample Street 2&#34;, &#34;City&#34;:&#34;Sample City 3&#34;}<br />]&#160;</div>
<p><strong>Dynamic4.json</strong>: (JSON which typically require <strong>jsonReader: {</strong><strong>repeatitems: false</strong>})</p>
<p><input type='button' class='sfcodeselect' name='sfselectit8657' value='Select Code' data-codeid='sfcode8657' /></p>
<div class='sfcode' id='sfcode8657'>{<br />&#34;page&#34;:1,<br />&#34;total&#34;:37,<br />&#34;records&#34;:722,<br />&#34;rows&#34;:[<br />&#160; &#160; {&#34;Id&#34;:1, &#34;Name&#34;:&#34;Sample name 1&#34;, &#34;Street&#34;:&#34;Sample Street 2&#34;, &#34;City&#34;:&#34;Sample City 3&#34;},<br />&#160; &#160; {&#34;Id&#34;:2, &#34;Name&#34;:&#34;Sample name 2&#34;, &#34;Street&#34;:&#34;Sample Street 2&#34;, &#34;City&#34;:&#34;Sample City 3&#34;}<br />]<br />}</div>
<p>Even more complex exotical JSON data like</p>
<p><input type='button' class='sfcodeselect' name='sfselectit1443' value='Select Code' data-codeid='sfcode1443' /></p>
<div class='sfcode' id='sfcode1443'>[<br />&#160; &#160; [1, &#34;Sample name 1&#34;,&#34;Sample Street 2&#34;,&#34;Sample City 3&#34;],<br />&#160; &#160; {&#34;Id&#34;:2, &#34;Name&#34;:&#34;Sample name 2&#34;, &#34;Street&#34;:&#34;Sample Street 2&#34;, &#34;City&#34;:&#34;Sample City 3&#34;}<br />]</div>
<p><span style="font-size: 14px;">(see </span><a style="font-size: 14px;" href="http://www.ok-soft-gmbh.com/jqGrid/dynamicReader/DynamicReader5.htm" target="_blank">demo5</a><span style="font-size: 14px;">) will be successfully readed.</span></p>
<p>As I wrote before the code from <a href="http://www.ok-soft-gmbh.com/jqGrid/jquery.jqGrid-4.4.4/js/jquery.jqGrid.src-dynamicReader.js" target="_blank">jquery.jqGrid.src-dynamicReader.js</a> is still not final. One should make some changes to read the last part of the data in case of usage&#160;<strong>loadonce: true</strong>, make close modifications to set pager to possible the best values, make modifications of <strong>addXmlData</strong>&#8230; Nevertheless I hope you understand which modification I try to suggest.</p>
<p>If you want I can post modifications from <a href="http://www.ok-soft-gmbh.com/jqGrid/jquery.jqGrid-4.4.4/js/jquery.jqGrid.src-dynamicReader.js" target="_blank">jquery.jqGrid.src-dynamicReader.js</a>&#160;as pull request.</p>
<p>Best regards<br />Oleg</p>
]]></description>
        	        	<pubDate>Wed, 06 Mar 2013 12:48:10 +0200</pubDate>
        </item>
        <item>
        	<title>tony on autodetection of input JSON format</title>
        	<link>http://www.trirand.com/blog/?page_id=393/feature-request/autodetection-of-input-json-format#p28402</link>
        	<category>Feature Request</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/feature-request/autodetection-of-input-json-format#p28402</guid>
        	        	<description><![CDATA[<p>Hello Oleg,</p>
</p>
<p>This good recommendation, but I do not see a needed place where we can do this.</p>
<p>look here and <a href="https://github.com/tonytomov/jqGrid/blob/v4.4.4/js/grid.base.js#L1348" target="_blank">here</a>&#160; and then <a href="https://github.com/tonytomov/jqGrid/blob/v4.4.4/js/grid.base.js#L1410" target="_blank">here</a></p>
</p>
<p>Regards</p>
]]></description>
        	        	<pubDate>Wed, 06 Mar 2013 10:01:01 +0200</pubDate>
        </item>
        <item>
        	<title>OlegK on autodetection of input JSON format</title>
        	<link>http://www.trirand.com/blog/?page_id=393/feature-request/autodetection-of-input-json-format#p28387</link>
        	<category>Feature Request</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/feature-request/autodetection-of-input-json-format#p28387</guid>
        	        	<description><![CDATA[<p>Just one remark. <a href="http://stackoverflow.com/a/3214240/315935" target="_blank">The simple answer</a>&#160;about the usage of</p>
<p><input type='button' class='sfcodeselect' name='sfselectit9693' value='Select Code' data-codeid='sfcode9693' /></p>
<div class='sfcode' id='sfcode9693'>jsonReader : { repeatitems: false }</div>
<p>has high score. Just now it was increated to one more point. It means that one more peaple made the same error, have received exception and spend his time in searching of solution of the problem. Exactly the fact pushed me to post the feature request about dynamical detection of the input format. Only if the used <strong>repeatitems</strong> value is definitive wrong one can change it and be able do load the data instead of producing exception and showing "loading..." message forever.</p>
<p>Rest regards<br />Oleg&#160;</p>
]]></description>
        	        	<pubDate>Tue, 05 Mar 2013 15:06:18 +0200</pubDate>
        </item>
        <item>
        	<title>OlegK on autodetection of input JSON format</title>
        	<link>http://www.trirand.com/blog/?page_id=393/feature-request/autodetection-of-input-json-format#p28348</link>
        	<category>Feature Request</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/feature-request/autodetection-of-input-json-format#p28348</guid>
        	        	<description><![CDATA[<p>Hello Tony,</p>
<p>one common error of newcommer is the usage of wrong JSON format or incorrect usage of <strong>jsonReader</strong>. Two formats are very common:</p>
<p>1) <strong>jsonReader: {repeatitems: false}</strong>. One produces the data in the format, but don&#39;t includes jsonReader: {repeatitems: false} as jqGrid option. One could include simple test whether items which represent the row as array or not. Directly after reading of root element (see <a href="https://github.com/tonytomov/jqGrid/blob/v4.4.4/js/grid.base.js#L1362" target="_blank">here</a>) or <a href="https://github.com/tonytomov/jqGrid/blob/v4.4.4/js/grid.base.js#L1377" target="_blank">later</a>&#160;one can include testing of the type of the row and to use either the reader from array or the reader from named object.</p>
<p>2) <strong>jsonReader: {repeatitems: false, root: function (obj) { return obj; }}, loadonce: true</strong>. The case is very common especially for newcommer or for the case when somebode try to include jqGrid in <em>exsiting</em>&#160;web project. One can test directly at the beginning of <em>addJSONData</em>&#160;whether the input <strong>data</strong> parameter is array. In the case one can use <strong>root</strong> defined as the function before.</p>
<p>It seems to me that introduction of autodetection of input format&#160;of JSON data could be very practical feature of jqGrid from the user&#39;s point of view.</p>
<p>Best wisches<br />Oleg&#160;</p>
]]></description>
        	        	<pubDate>Thu, 28 Feb 2013 12:33:56 +0200</pubDate>
        </item>
</channel>
</rss>