<?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: populate array using addRowData with array</title>
	<link>http://www.trirand.com/blog/?page_id=393/bugs/populate-array-using-addrowdata-with-array</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/populate-array-using-addrowdata-with-array/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>OlegK on populate array using addRowData with array</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/populate-array-using-addrowdata-with-array#p28013</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/populate-array-using-addrowdata-with-array#p28013</guid>
        	        	<description><![CDATA[<p>You are right Tony! One should test only for <strong>undefined</strong> value.</p>
]]></description>
        	        	<pubDate>Sat, 12 Jan 2013 12:20:30 +0200</pubDate>
        </item>
        <item>
        	<title>tony on populate array using addRowData with array</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/populate-array-using-addrowdata-with-array#p28012</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/populate-array-using-addrowdata-with-array#p28012</guid>
        	        	<description><![CDATA[<p>Hello,</p>
</p>
<p>Thank you for the bug fix.</p>
<p>Oleg I do not think that your fix is fine.</p>
<p>Suppose the rowid becomes 0 (data[cnm]=0), then the logic will go to randid which is not correct.</p>
</p>
<p>I think that the fix from GeorgeG is ok and I will implent this fix.</p>
<p>Thanks again</p>
</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Sat, 12 Jan 2013 10:36:40 +0200</pubDate>
        </item>
        <item>
        	<title>OlegK on populate array using addRowData with array</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/populate-array-using-addrowdata-with-array#p28006</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/populate-array-using-addrowdata-with-array#p28006</guid>
        	        	<description><![CDATA[<p>I think that the line</p>
<p><input type='button' class='sfcodeselect' name='sfselectit421' value='Select Code' data-codeid='sfcode421' /></p>
<div class='sfcode' id='sfcode421'>try {rowid = data[cnm];}</div>
<p>can be fixed to</p>
<p><input type='button' class='sfcodeselect' name='sfselectit5612' value='Select Code' data-codeid='sfcode5612' /></p>
<div class='sfcode' id='sfcode5612'>try {rowid = data[cnm] &#124;&#124; $.jgrid.randId();}</div>
<p>which is equivalent to (short form)</p>
<p><input type='button' class='sfcodeselect' name='sfselectit916' value='Select Code' data-codeid='sfcode916' /></p>
<div class='sfcode' id='sfcode916'>try {rowid = data[cnm] ? data[cnm]&#160;: $.jgrid.randId();}</div>
<p>Best regards<br />Oleg</p>
<p>P.S. I suppose that Tony will make the corresponding changes in the code of jqGrid after reading of your bug report.</p>
]]></description>
        	        	<pubDate>Fri, 11 Jan 2013 13:43:39 +0200</pubDate>
        </item>
        <item>
        	<title>GeorgeG on populate array using addRowData with array</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/populate-array-using-addrowdata-with-array#p28003</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/populate-array-using-addrowdata-with-array#p28003</guid>
        	        	<description><![CDATA[<p>Hello All,</p>
</p>
<p>I think I have found a bug in addRowData (grid.base.js), when using jqGrid with a local array.</p>
<p>If the rowid is not supplied, or does not exist in the source array, there is an attempt to fallback to the internal id generation mechanism, as follows (lines 2961-2962):</p>
<p>try {rowid = data[cnm];}<br />catch (e) {rowid = $.jgrid.randId();}</p>
<p>when data[cnm] does not exist Javascript (at least with the latest version of Chrome, Firefox IExplorer and a Web Browser (debian) 2.30.6) will not throw an exception for the assignment, so there is nothing to "catch".</p>
<p>The effect on the browser, is that the id of all the rows will be undefined.&#160; As such when the user clicks any row, the first row is selected (as the string "undefined" is assigned to all the rowids).&#160; The ids get populated properly if the rows are sorted (via a sortable column).</p>
<p>My temporary fix was to replace the two lines above with the following:</p>
<p>try { rowid = data[cnm];<br />&#160;&#160;&#160; if(rowid ===undefined) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; rowid = $.jgrid.randId();<br />&#160;&#160;&#160; }<br />} catch (e) {rowid = $.jgrid.randId();}</p>
<p>I don&#39;t think that the "fix" above breaks anything.</p>
</p>
<p>p.s.: Don&#39;t ask me why I used jqGrid with an array and an undefined id column&#8230;</p>
</p>
<p>Regards,</p>
<p>GeorgeG</p>
</p>
<p>Edited to correct late night/early morning typing errors 🙂</p>
]]></description>
        	        	<pubDate>Fri, 11 Jan 2013 04:54:25 +0200</pubDate>
        </item>
</channel>
</rss>