<?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: duplicate rowid produced by addRow</title>
	<link>http://www.trirand.com/blog/?page_id=393/bugs/duplicate-rowid-produced-by-addrow</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/duplicate-rowid-produced-by-addrow/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>OlegK on duplicate rowid produced by addRow</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/duplicate-rowid-produced-by-addrow#p27696</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/duplicate-rowid-produced-by-addrow#p27696</guid>
        	        	<description><![CDATA[<p>Sorry, my last suggestion was based on my *original* code where the value of <strong>rowID</strong> was <strong>undefined</strong>. One uses <strong>$.extend</strong> with input parameters. So one can&#39;t ovewrite any other value with the <strong>undefined</strong> value. If you use <strong>null</strong> as the default value then <strong>rowID</strong> will never been <strong>undefined</strong>, but it&#39;s not a real problem. So your previous suggestion will work exacly so good as the last one. Sorry for the misunderstanding.</p>
<p>Regards<br />Oleg</p>
]]></description>
        	        	<pubDate>Thu, 08 Nov 2012 13:26:49 +0200</pubDate>
        </item>
        <item>
        	<title>tony on duplicate rowid produced by addRow</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/duplicate-rowid-produced-by-addrow#p27693</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/duplicate-rowid-produced-by-addrow#p27693</guid>
        	        	<description><![CDATA[<p>Oleg,</p>
<p>Ok. Changed, but I think nobody will set a undefined.</p>
</p>
<p>Regards</p>
]]></description>
        	        	<pubDate>Thu, 08 Nov 2012 11:59:08 +0200</pubDate>
        </item>
        <item>
        	<title>OlegK on duplicate rowid produced by addRow</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/duplicate-rowid-produced-by-addrow#p27692</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/duplicate-rowid-produced-by-addrow#p27692</guid>
        	        	<description><![CDATA[<p>Yes, of cause! But I think that it&#39;s better to use <strong>(p.rowID != null)</strong>&#160;instead of <strong>(p.rowID !== null)</strong>&#160;to test for not <strong>null</strong> or not <strong>undefined</strong> instead of testing for null only.</p>
<p>Regards</p>
]]></description>
        	        	<pubDate>Thu, 08 Nov 2012 11:38:59 +0200</pubDate>
        </item>
        <item>
        	<title>tony on duplicate rowid produced by addRow</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/duplicate-rowid-produced-by-addrow#p27690</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/duplicate-rowid-produced-by-addrow#p27690</guid>
        	        	<description><![CDATA[</p>
<p>Thanks Oleg.</p>
</p>
<p>Published in GitHub. You maybe mean :</p>
<p><strong>(p.rowID !== null) ? p.rowID : $.jgrid.randId() <img class="spSmiley" style="margin:0" title="Wink" src="/blog/wp-content/forum-smileys/sf-wink.gif" alt="Wink" /></strong></p>
</p>
<p>Best Regards</p>
<p><strong><br /></strong></p>
]]></description>
        	        	<pubDate>Thu, 08 Nov 2012 11:29:13 +0200</pubDate>
        </item>
        <item>
        	<title>OlegK on duplicate rowid produced by addRow</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/duplicate-rowid-produced-by-addrow#p27689</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/duplicate-rowid-produced-by-addrow#p27689</guid>
        	        	<description><![CDATA[<p>Hello Tony,</p>
<p>you are right. It&#39;s better to use<strong>&#160;</strong></p>
<p><input type='button' class='sfcodeselect' name='sfselectit7393' value='Select Code' data-codeid='sfcode7393' /></p>
<div class='sfcode' id='sfcode7393'><strong>(p.rowID == null) ? p.rowID : $.jgrid.randId()</strong></div>
<p>(test for <strong>null</strong> or <strong>undefined</strong>) instead of<strong></strong></p>
<p><input type='button' class='sfcodeselect' name='sfselectit164' value='Select Code' data-codeid='sfcode164' /></p>
<div class='sfcode' id='sfcode164'><strong></strong><strong>p.rowID ? p.rowID : $.jgrid.randId()</strong></div>
<p>Regards<br />Oleg</p>
]]></description>
        	        	<pubDate>Thu, 08 Nov 2012 11:15:27 +0200</pubDate>
        </item>
        <item>
        	<title>tony on duplicate rowid produced by addRow</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/duplicate-rowid-produced-by-addrow#p27688</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/duplicate-rowid-produced-by-addrow#p27688</guid>
        	        	<description><![CDATA[<p>Hello Oleg,</p>
<p>Thanks. This is ok.</p>
<p>The only thing for me is that the rowID should be set from undefined to null and we should perform check if</p>
<p>we want to add a row with id = 0, then this <strong>p.rowID ? p.rowID : $.jgrid.randId()</strong></p>
<p>will produce bad call of randID.</p>
<p>Regards</p>
]]></description>
        	        	<pubDate>Thu, 08 Nov 2012 10:49:14 +0200</pubDate>
        </item>
        <item>
        	<title>OlegK on duplicate rowid produced by addRow</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/duplicate-rowid-produced-by-addrow#p27676</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/duplicate-rowid-produced-by-addrow#p27676</guid>
        	        	<description><![CDATA[<p>Hello Tony,</p>
<p>default parameter of <strong>addRow</strong> contains <strong>rowID: "new_row"</strong>. As the result the simplest usage of <strong>inlineNav</strong> with local grid (having editurl: "clientArray") will produce id duplicates if one add multiple rows to the grid with respect of clicking on the "Add" button.</p>
<p>Additional problem is that one can&#39;t use function as the value of <strong>rowID</strong>. So one can&#39;t produce unique ids or just <em>different</em> ids in a simple way.</p>
<p>I suggest to fix the code of in the following way (I marked changed places with bold font):</p>
<p><input type='button' class='sfcodeselect' name='sfselectit7993' value='Select Code' data-codeid='sfcode7993' /></p>
<div class='sfcode' id='sfcode7993'>addRow : function ( p ) {<br />&#160; &#160; p = $.extend(true, {<br />&#160; &#160; &#160; &#160; rowID : <strong>undefined</strong>,<br />&#160; &#160; &#160; &#160; initdata : {},<br />&#160; &#160; &#160; &#160; position :&#34;first&#34;,<br />&#160; &#160; &#160; &#160; useDefValues : true,<br />&#160; &#160; &#160; &#160; useFormatter : false,<br />&#160; &#160; &#160; &#160; addRowParams : {extraparam:{}}<br />&#160; &#160; },p &#160;&#124;&#124; {});<br />&#160; &#160; return this.each(function(){<br />&#160; &#160; &#160; &#160; var $t = this<strong>,<br />&#160; &#160; &#160; &#160; &#160; &#160; rowID = $.isFunction(p.rowID) ? p.rowID.call($t, p) : (p.rowID ? p.rowID : $.jgrid.randId())</strong>;<br />&#160; &#160; &#160; &#160; ...<br />&#160; &#160; &#160; &#160; ... in the code below the usage of p.rowID will be replaced to&#160;<br />&#160; &#160; &#160; &#160; ... the usage of new rowID variable.<br />&#160; &#160; &#160; &#160; ...<br />&#160; &#160; });<br />},&#160;</div>
<p>I changed the default value of <strong>rowID</strong> to <strong>undefined</strong> to force call of in case of the simplest usage of <strong>addRow</strong> method. Additionally <a href="https://github.com/tonytomov/jqGrid/blob/v4.4.1/js/grid.inlinedit.js#L421" target="_blank">the line</a>&#160;</p>
<p><input type='button' class='sfcodeselect' name='sfselectit3911' value='Select Code' data-codeid='sfcode3911' /></p>
<div class='sfcode' id='sfcode3911'>addParams : {useFormatter : false,rowID : &#34;new_row&#34;},</div>
<p>of <strong>inlineNav</strong>&#160;which defines default values of <strong>inlineNav</strong>&#160;should be changed to</p>
<p><input type='button' class='sfcodeselect' name='sfselectit4242' value='Select Code' data-codeid='sfcode4242' /></p>
<div class='sfcode' id='sfcode4242'>addParams : <strong>{}</strong>,</div>
<p>Best regards<br />Oleg</p>
]]></description>
        	        	<pubDate>Wed, 07 Nov 2012 14:39:18 +0200</pubDate>
        </item>
</channel>
</rss>