<?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: small bug with reading id=0</title>
	<link>http://www.trirand.com/blog/?page_id=393/bugs/small-bug-with-reading-id0</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/small-bug-with-reading-id0/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>tony on small bug with reading id=0</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/small-bug-with-reading-id0#p28534</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/small-bug-with-reading-id0#p28534</guid>
        	        	<description><![CDATA[<p>Hello Oleg,</p>
<p>Thanks.</p>
</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Wed, 27 Mar 2013 09:49:33 +0200</pubDate>
        </item>
        <item>
        	<title>OlegK on small bug with reading id=0</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/small-bug-with-reading-id0#p28519</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/small-bug-with-reading-id0#p28519</guid>
        	        	<description><![CDATA[<p>Hallo Tony,</p>
<p>during answering on one question I found the bug in <a href="https://github.com/tonytomov/jqGrid/blob/v4.4.4/js/grid.base.js#L1384" target="_blank">the line</a>&#160;of code</p>
<p><input type='button' class='sfcodeselect' name='sfselectit3055' value='Select Code' data-codeid='sfcode3055' /></p>
<div class='sfcode' id='sfcode3055'>idr = ccur !== undefined ? ccur[idn] &#124;&#124; idr : idr;</div>
<p>(and <a href="https://github.com/tonytomov/jqGrid/blob/v4.4.4/js/grid.base.js#L1481" target="_blank">this one</a> too</p>
<p><input type='button' class='sfcodeselect' name='sfselectit6701' value='Select Code' data-codeid='sfcode6701' /></p>
<div class='sfcode' id='sfcode6701'>idr = ccur2[idn] &#124;&#124; idr;</div>
<p>later in the code). The problem one have if&#160;<strong>ccur[idn]</strong>&#160;(or <strong>ccur2[idn]</strong>) is 0 (the id of the row is numeric 0). In the case it will be used idr instead of <strong>ccur[idn]</strong>&#160;(or&#160;<strong>ccur2[idn]</strong>) which can follow to <em>id dupplicates</em>.</p>
<p>To fix the problem one should test for <strong>ccur[idn]&#160;!== undefined</strong> instead of usage &#124;&#124; operation. Additionally one can change the first test <strong>ccur !== undefined</strong> to <strong>ccur != null</strong>, to be sure that <strong>ccur</strong>&#160;is neither <strong>undefined</strong>&#160;nor <strong>null</strong>&#160;before usage of <strong>ccur[idn]</strong>.</p>
<p>By the way to reproduce the proglem one can add <strong>key: true</strong> to some colum and use standard format where <strong>cell</strong> array is defined in JSON input data. For example</p>
<p><input type='button' class='sfcodeselect' name='sfselectit6697' value='Select Code' data-codeid='sfcode6697' /></p>
<div class='sfcode' id='sfcode6697'>{&#34;rows&#34;:[{&#34;cell&#34;:[0,...]}, {&#34;cell&#34;:[1,...]}, ...]}</div>
<p><span style="font-size: 14px;">In the case <strong>idn</strong> will be set to 0 (index of the first column which has <strong>key:true</strong> property). <a href="https://github.com/tonytomov/jqGrid/blob/v4.4.4/js/grid.base.js#L1378" target="_blank">The line</a></span></p>
<p><input type='button' class='sfcodeselect' name='sfselectit2133' value='Select Code' data-codeid='sfcode2133' /></p>
<div class='sfcode' id='sfcode2133'>idr = $.jgrid.getAccessor(cur,idn);</div>
<p>will returns <em>always</em> undefined value and we will fall down in the case which I descrined above.</p>
<p>Best regards<br />Oleg&#160;</p></p>
]]></description>
        	        	<pubDate>Mon, 25 Mar 2013 13:03:40 +0200</pubDate>
        </item>
</channel>
</rss>