<?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: NaN as total number of pages for JSON/XML data with 0 rows</title>
	<link>http://www.trirand.com/blog/?page_id=393/bugs/nan-as-total-number-of-pages-for-jsonxml-data-with-0-rows</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/bugs/nan-as-total-number-of-pages-for-jsonxml-data-with-0-rows/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>tony on NaN as total number of pages for JSON/XML data with 0 rows</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/nan-as-total-number-of-pages-for-jsonxml-data-with-0-rows#p20434</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/nan-as-total-number-of-pages-for-jsonxml-data-with-0-rows#p20434</guid>
        	        	<description><![CDATA[<p>Hello Oleg,</p>
<p>Also fixed.</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Sat, 23 Oct 2010 12:28:31 +0300</pubDate>
        </item>
        <item>
        	<title>susam on NaN as total number of pages for JSON/XML data with 0 rows</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/nan-as-total-number-of-pages-for-jsonxml-data-with-0-rows#p20236</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/nan-as-total-number-of-pages-for-jsonxml-data-with-0-rows#p20236</guid>
        	        	<description><![CDATA[</p>
<p><span style="color: #000000;"><strong></strong><strong>Hi OlegK,</strong></span></p>
<p><strong>I got a problem like this, </strong></p>
<p><a href="http://dl.javaeye.com/upload/picture/pic/73984/69092d01-c7b0-3a98-bc73-83c7122e53ec.jpg" rel="nofollow" target="_blank"><a href="http://dl.javaeye.com/upload/p" rel="nofollow">http://dl.javaeye.com/upload/p</a>.....2e53ec.jpg</a></p>
<p><strong>when the total records is less than 1000, it works good; But it doesn&#39;t work&#160; more than 1000 (not exact figures</strong><strong>) like below:</strong></p>
<p><a href="http://dl.javaeye.com/upload/picture/pic/73982/86a8384b-533c-3bfa-bbc8-5e3ebb6bceab.jpg" rel="nofollow" target="_blank"><a href="http://dl.javaeye.com/upload/p" rel="nofollow">http://dl.javaeye.com/upload/p</a>.....6bceab.jpg</a></p>
</p>
<p>&#60;?xml version ="1.0&#8243; encoding="utf-8&#8243;?&#62;</p>
<p>&#60;rows&#62;<br />&#160; &#60;page&#62;${page}&#60;/page&#62;<br />&#160; &#60;total&#62;${totalPages}&#60;/total&#62;<br />&#160; &#60;records&#62;${records}&#60;/records&#62;<br />&#160;&#160;&#160; &#60;#list attendances as att&#62;<br />&#160;&#160;&#160; &#60;row id ="${att.id.bh}"&#62;<br />&#160;&#160;&#160;&#160;&#160; &#60;cell&#62;${att.id.bh}&#60;/cell&#62;<br />&#160;&#160;&#160;&#160;&#160; &#60;cell&#62;${att.xm!}&#60;/cell&#62;<br />&#160;&#160;&#160;&#160;&#160; &#8230;<br />&#160;&#160;&#160; &#60;/row&#62;<br />&#160;&#160;&#160; &#60;/#list&#62;<br />&#60;/rows&#62;</p>
<p><strong>jqGrid version is 3.8!</strong></p>
<p><strong><br /></strong></p>
<p>Best regards!</p>
<p>Ken</p>
<p><span style="color: #ff0000;">Sorry, I found the reason, because I make the number as string! </span></p>
]]></description>
        	        	<pubDate>Tue, 12 Oct 2010 10:28:45 +0300</pubDate>
        </item>
        <item>
        	<title>OlegK on NaN as total number of pages for JSON/XML data with 0 rows</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/nan-as-total-number-of-pages-for-jsonxml-data-with-0-rows#p19982</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/nan-as-total-number-of-pages-for-jsonxml-data-with-0-rows#p19982</guid>
        	        	<description><![CDATA[<p>Hello Tony,</p>
<p>You are right, this is <em>a workaround</em>. In the <a href="http://stackoverflow.com/questions/3755396/jqgrid-pager-says-1-of-nan" target="_blank">question</a> which initialized my post here it was used as a solution. I posted this problem here because I look at the problem from a little other side.</p>
<p>It seems to me the problem which appears once will appear next time for other users. It would be better if one make jqGrid code a little more robust in case of missing some input information. I mean that it would be nice if jqGrid be able to display empty table not only for</p>
<p>{"page":1, "records":0, "total":1, rows:[]}</p>
<p>but also for</p>
<p>{"page":1, "records":0, "total":1}</p>
<p>{"page":0, "records":0, "total":0}</p>
<p>{"records":0}</p>
<p>or</p>
<p>{}</p>
<p>The most part of codes use already default values for missing input parameters. For example you use</p>
<p>&#160;&#160;&#160; ts.p.page = $.jgrid.getAccessor(data,dReader.page) &#124;&#124; 0;<br />&#160;&#160;&#160; lp = $.jgrid.getAccessor(data,dReader.total);<br />&#160;&#160;&#160; ts.p.lastpage = lp === undefined ? 1 : lp;<br />&#160;&#160;&#160; ts.p.records = $.jgrid.getAccessor(data,dReader.records) &#124;&#124; 0;<br />&#160;&#160;&#160; ts.p.userData = $.jgrid.getAccessor(data,dReader.userdata) &#124;&#124; {};</p>
<p>so you <em>tried already</em> to make the code working for undefined input data. The change of the code</p>
<p>&#160;&#160;&#160; drows = $.jgrid.getAccessor(data,dReader.root)<strong></strong>;<br />&#160;&#160;&#160; if (!drows) { return; }</p>
<p>to one line</p>
<p>&#160;&#160;&#160; drows = $.jgrid.getAccessor(data,dReader.root)<strong> &#124;&#124; {}</strong>;</p>
<p>seems for me the best pragmatic solution of the problem which just follow the other parts of code.</p>
<p>Best regards<br />Oleg</p>
]]></description>
        	        	<pubDate>Fri, 24 Sep 2010 11:51:05 +0300</pubDate>
        </item>
        <item>
        	<title>tony on NaN as total number of pages for JSON/XML data with 0 rows</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/nan-as-total-number-of-pages-for-jsonxml-data-with-0-rows#p19974</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/nan-as-total-number-of-pages-for-jsonxml-data-with-0-rows#p19974</guid>
        	        	<description><![CDATA[<p>Oleg,</p>
<p>Thanks. I think that the lines in 3.8 are OK, since you missed in the response the empty array. - i.e in your example we have</p>
<p>{"page":1, "records":0, "total":1}</p>
<p>but I think it should be</p>
<p>{"page":1, "records":0, "total":1, rows:[]}</p>
</p>
<p>What do you think?</p>
</p>
<p>Kind regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Fri, 24 Sep 2010 09:23:54 +0300</pubDate>
        </item>
        <item>
        	<title>OlegK on NaN as total number of pages for JSON/XML data with 0 rows</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/nan-as-total-number-of-pages-for-jsonxml-data-with-0-rows#p19905</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/nan-as-total-number-of-pages-for-jsonxml-data-with-0-rows#p19905</guid>
        	        	<description><![CDATA[<p>Hi Tony!</p>
<p>In jqGrid 3.7.2 the lines 1098 and 1239 of <em>grid.base.js</em>&#160;should be fixed from&#160;</p>
<p>&#160;&#160; &#160;if(locdata) {</p>
<p>to</p>
<p>&#160;&#160; &#160;if(locdata<strong> &#38;&#38; rn</strong>) {</p>
<p>because in case of JSON/XML data rn and len will be undefined. And as a result if <strong>loadonce:true</strong> one will see <a href="http://www.ok-soft-gmbh.com/jqGrid/NoData0.htm" rel="nofollow" target="_blank"><a href="http://www.ok-soft-gmbh.com/jq" rel="nofollow">http://www.ok-soft-gmbh.com/jq</a>.....oData0.htm</a>. After the fixes the empty grid looks like <a href="http://www.ok-soft-gmbh.com/jqGrid/NoData1.htm" rel="nofollow" target="_blank"><a href="http://www.ok-soft-gmbh.com/jq" rel="nofollow">http://www.ok-soft-gmbh.com/jq</a>.....oData1.htm</a>.</p>
<p>The problem with jqGrid 3.8 in <strong>MUCH MORE</strong> hard. You&#160;inserted&#160;line 1196</p>
<p>&#160;&#160; &#160;if (!drows) { return; }</p>
<p>after</p>
<p>drows = $.jgrid.getAccessor(data,dReader.root);</p>
<p>which is wrong. Some&#160;initializations&#160;like&#160;</p>
<p>&#160;&#160; &#160;if(ts.p.userDataOnFooter) { $(ts).jqGrid("footerData","set",ts.p.userData,true); }</p>
<p>and</p>
<p>&#160;&#160; &#160;if (!more) { ts.updatepager(false,true); }</p>
<p>and probably</p>
<p>&#160;&#160; &#160;ts.p.treeANode = -1;</p>
<p>must be done. In the current version of &#160;jqGrid 3.8 updatepager() will not called the pager will not filled and gridComplete will not called at all.</p>
<p>Best regards<br /><span style="font-size: 13.8889px;">Oleg</span></p>
]]></description>
        	        	<pubDate>Tue, 21 Sep 2010 18:07:36 +0300</pubDate>
        </item>
</channel>
</rss>