<?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: delRowData bug on Grid with Multiselect</title>
	<link>http://www.trirand.com/blog/?page_id=393/bugs/delrowdata-bug-on-grid-with-multiselect</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/delrowdata-bug-on-grid-with-multiselect/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>meh-cfl on delRowData bug on Grid with Multiselect</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/delrowdata-bug-on-grid-with-multiselect#p27930</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/delrowdata-bug-on-grid-with-multiselect#p27930</guid>
        	        	<description><![CDATA[<p>I think I ran into this problem myself, the issue is that when the row is deleted by jqGrid it is (quite rightly) removed from the list of selected rows.</p>
<p>If when you loop over the rows to delete you are just looping over the list of selected rows then this array is changed on the fly by the delete function so it doesn&#39;t work quite as you might expect.</p>
<p>The workaround is to copy the array of selected rows using .slice() - or you could always try and delete the first entry in the array of selected rows.</p>
]]></description>
        	        	<pubDate>Tue, 18 Dec 2012 13:08:16 +0200</pubDate>
        </item>
        <item>
        	<title>nesken on delRowData bug on Grid with Multiselect</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/delrowdata-bug-on-grid-with-multiselect#p27238</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/delrowdata-bug-on-grid-with-multiselect#p27238</guid>
        	        	<description><![CDATA[<blockquote>
<p>nesken said:</p>
<blockquote>
<p>onoank said:</p>
</blockquote>
<blockquote>
<p>Non of the solutions above work for me 🙁</p>
<p>Is there any solutions??</p>
</blockquote>
<hr />
<p>I had exactly the same problem and, as they explained above, the solution is to iterate the array downwards. This is a copy of my code that is working fine. You can include an alert in the middle of the loop to see how the rows are deleted starting from the tail.</p>
<p>var rowids = $(&#39;#list&#39;).jqGrid(&#39;getGridParam&#39;, &#39;selarrrow&#39;);</p>
<p>for (var i = rowids.length - 1; i &#62;= 0; i--) {</p>
<p>&#160; &#160; $(&#39;#list&#39;).jqGrid(&#39;delRowData&#39;, rowids[i]);</p>
<p>}</p>
</p>
<p>I noticed the code above has a missing "-", check it out:</p>
<p>for(var i=len-1; i&#62;=0; <span style="color: #ff0000;">i&#8211;</span>){</p>
</blockquote>
<hr />
<p>For some reason when I posted "i--" was change for "i-", you have to include two (2) &#160;dashes.</p>
]]></description>
        	        	<pubDate>Fri, 31 Aug 2012 16:30:55 +0300</pubDate>
        </item>
        <item>
        	<title>nesken on delRowData bug on Grid with Multiselect</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/delrowdata-bug-on-grid-with-multiselect#p27237</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/delrowdata-bug-on-grid-with-multiselect#p27237</guid>
        	        	<description><![CDATA[<blockquote>
<p>onoank said:</p>
</blockquote>
<blockquote>
<p>Non of the solutions above work for me 🙁</p>
<p>Is there any solutions??</p>
</blockquote>
<hr />
<p>I had exactly the same problem and, as they explained above, the solution is to iterate the array downwards. This is a copy of my code that is working fine. You can include an alert in the middle of the loop to see how the rows are deleted starting from the tail.</p>
<p>var rowids = $(&#39;#list&#39;).jqGrid(&#39;getGridParam&#39;, &#39;selarrrow&#39;);</p>
<p>for (var i = rowids.length - 1; i &#62;= 0; i--) {</p>
<p>&#160; &#160; $(&#39;#list&#39;).jqGrid(&#39;delRowData&#39;, rowids[i]);</p>
<p>}</p>
</p>
<p>I noticed the code above has a missing "-", check it out:</p>
<p>for(var i=len-1; i&#62;=0; <span style="color: #ff0000;">i&#8211;</span>){</p>
]]></description>
        	        	<pubDate>Fri, 31 Aug 2012 16:26:54 +0300</pubDate>
        </item>
        <item>
        	<title>onoank on delRowData bug on Grid with Multiselect</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/delrowdata-bug-on-grid-with-multiselect#p27085</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/delrowdata-bug-on-grid-with-multiselect#p27085</guid>
        	        	<description><![CDATA[<p>Non of the solutions above work for me 🙁</p>
<p>Is there any solutions??</p>
]]></description>
        	        	<pubDate>Tue, 07 Aug 2012 11:19:14 +0300</pubDate>
        </item>
        <item>
        	<title>tempel on delRowData bug on Grid with Multiselect</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/delrowdata-bug-on-grid-with-multiselect#p25980</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/delrowdata-bug-on-grid-with-multiselect#p25980</guid>
        	        	<description><![CDATA[<p>not cool</p>
]]></description>
        	        	<pubDate>Mon, 20 Feb 2012 16:06:01 +0200</pubDate>
        </item>
        <item>
        	<title>nate on delRowData bug on Grid with Multiselect</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/delrowdata-bug-on-grid-with-multiselect#p16388</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/delrowdata-bug-on-grid-with-multiselect#p16388</guid>
        	        	<description><![CDATA[<p>Using $.makeArray to make a copy works,&#160;however this method is faster:</p>
</p>
<p>var recs = $("#mygrid").getGridParam(&#39;selarrrow&#39;);</p>
<p>var len = recs.length;</p>
<p>for(var i=len-1; i&#62;=0; i&#8211;){</p>
<p>&#160;&#160; &#160; &#160;$("#mygrid").delRowData(recs[i]);</p>
<p>}</p>
</p>
<p>Just traverse the array in reverse order.</p>
</p>
<p>~Nate</p>
]]></description>
        	        	<pubDate>Tue, 13 Apr 2010 23:12:09 +0300</pubDate>
        </item>
        <item>
        	<title>markw65 on delRowData bug on Grid with Multiselect</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/delrowdata-bug-on-grid-with-multiselect#p13460</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/delrowdata-bug-on-grid-with-multiselect#p13460</guid>
        	        	<description><![CDATA[<p>Tony,</p>
</p>
<p>I dont think it /is/ a problem with getGridParam. Its a problem with how its being used. When I call getGridParam, I expect to get the actual grid parameter...</p>
</p>
<p>If the user wants a copy of the array, its easy enough to call $.makeArray on it.</p>
</p>
<p>Or for this case, just iterate downwards...</p>
</p>
<p>Mark</p>
]]></description>
        	        	<pubDate>Wed, 30 Dec 2009 17:05:35 +0200</pubDate>
        </item>
        <item>
        	<title>tony on delRowData bug on Grid with Multiselect</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/delrowdata-bug-on-grid-with-multiselect#p13448</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/delrowdata-bug-on-grid-with-multiselect#p13448</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>First of all thanks for this. Also I do not consider your problem deeper, so sorry for this.</p>
<p>The problem is not in delRowData.</p>
<p>Let consider what is happen:</p>
<p>1. You call getGridParam with selarrrow. The method direct return this array.</p>
<p>In other words <strong>recs</strong> <strong>is reference to selarrrow</strong></p>
<p>2. You use this reference direct in the delRowData, but delRowData decreases the selarrrow (i.e the recs which is reference)</p>
<p>3. After every loop you have one elment little.</p>
<p>So to solve the problem I have modified the getGridParam</p>
<p>I will publish the fix soon. Need more testing.</p>
</p>
<p>Thanks again</p>
<p>Best regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Wed, 30 Dec 2009 10:49:15 +0200</pubDate>
        </item>
        <item>
        	<title>luny on delRowData bug on Grid with Multiselect</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/delrowdata-bug-on-grid-with-multiselect#p13441</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/delrowdata-bug-on-grid-with-multiselect#p13441</guid>
        	        	<description><![CDATA[<p>thanks,tony</p>
<p>add the test code in the loop ,please see:</p>
<p>var recs = $(&#8221;#mygrid&#8221;).getGridParam(&#39;selarrrow&#39;);</p>
<p>for(var i=0;i&#60;recs.length;i++){</p>
<p>&#160; alert( recs.length);&#160;&#160;&#160; // test code</p>
<p>&#160;&#160; $(&#8221;#mygrid&#8221;).delRowData(recs[i]);</p>
<p>}</p>
<p>I found&#160;&#160;the array recs&#39;s length in per loop is Decreasing, it&#39;s leads to the wrong cause</p>
<p>Later ,open jquery.jqGrid.min.js,delete this code:</p>
<p>&#160;ia = $.inArray(rowid,$t.p.selarrrow);<br />if(ia != -1) {$t.p.selarrrow.splice(ia,1);}</p>
<p>save it ,retest it ,delete mulitselect record&#160; is right, I don&#39;t know that why use splice function in deRowData ??</p>
]]></description>
        	        	<pubDate>Wed, 30 Dec 2009 04:51:47 +0200</pubDate>
        </item>
        <item>
        	<title>tony on delRowData bug on Grid with Multiselect</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/delrowdata-bug-on-grid-with-multiselect#p13314</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/delrowdata-bug-on-grid-with-multiselect#p13314</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>This is very strange. In form editing we use the same code sniplet to delete a rows when we are in multiselect mode.</p>
<p>I&#39;m not sure if this is connected with the delRowData, rather I think that there is a problem with the id&#39;s in the grid.</p>
<p>Best Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Sat, 26 Dec 2009 11:34:02 +0200</pubDate>
        </item>
        <item>
        	<title>lucy on delRowData bug on Grid with Multiselect</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/delrowdata-bug-on-grid-with-multiselect#p13293</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/delrowdata-bug-on-grid-with-multiselect#p13293</guid>
        	        	<description><![CDATA[<p>hello tony, I used the code:</p>
</p>
<p>var recs = $(&#8221;#mygrid&#8221;).getGridParam(&#39;selarrrow&#39;);</p>
<p>for(var i=0;i&#60;recs.length;i++){</p>
<p>&#160;&#160; $(&#8221;#mygrid&#8221;).delRowData(recs[i]);</p>
<p>}</p>
</p>
<p><span id="result_box" class="short_text"><span style="background-color: #ffffff;" title="ç»“æžœæ€»æ˜¯åªåˆ é™¤äº†é€‰ä¸­è®°å½•æ•°çš„æ¡æ•°å‡1">The results are  always just delete the selected count of records -1,why??thanks</span></span></p>
</p>
<p>ps:</p>
<p>var ids = new Array();</p>
<p>for(var i=0;i&#60;ids.length;i++)</p>
<p>ids[i] = selids[i];&#160;&#160;&#160;&#160; // copy the array to ids</p>
<p>for(var i=0;i&#60;ids.length;i++){</p>
<p>&#160;&#160;&#160; $(&#8221;#mygrid&#8221;).delRowData(ids[i]);</p>
<p>}</p>
<p>The result is right, I don&#39;t know if this is a bug?</p></p>
]]></description>
        	        	<pubDate>Thu, 24 Dec 2009 04:02:03 +0200</pubDate>
        </item>
        <item>
        	<title>tony on delRowData bug on Grid with Multiselect</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/delrowdata-bug-on-grid-with-multiselect#p5482</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/delrowdata-bug-on-grid-with-multiselect#p5482</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>If you try this way:</p>
<p>for(var i=0;i&#60;recs.length;i++){</p>
<p>$(&#8221;#mygrid&#8221;).delRowData(recs[i]);</p>
<p>}</p>
<p>What is happen?</p>
<p>Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Sat, 21 Mar 2009 11:00:12 +0200</pubDate>
        </item>
        <item>
        	<title>bonjo on delRowData bug on Grid with Multiselect</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/delrowdata-bug-on-grid-with-multiselect#p5472</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/delrowdata-bug-on-grid-with-multiselect#p5472</guid>
        	        	<description><![CDATA[<p>For some unknown reason, when I try to loop on the selected rows on a multi select grid to delete it, the array containing the keys/rowid lose values thus not completing the whole deletion process.</p>
<p>For e.g:</p>
<p>var recs = $(&#8221;#mygrid&#8221;).getGridParam(&#39;selarrrow&#39;);</p>
<p>(recs variable in this example would hold [4,1] -&#62; the row id&#39;s multiselected)</p>
<p>//alert(recs); -&#62;should display 4,1</p>
<p>jQuery.each(recs,function(i,v){</p>
<p>&#160;&#160; alert(v);</p>
<p>&#160;&#160; $(&#8221;#mygrid&#8221;).delRowData(v);</p>
<p>});</p>
<p>The initial loop alert will display 4 and then remove the row with id 4. The next loop will display &#8220;undefined&#8221; in the alert box thus halting further row removal (with id = 1).</p>
<p>Inspecting grid.base.js, I have found that this line (306) is causing the problem</p>
<p><em>[line 306]&#160;&#160;&#160; if(ia != -1) {$t.p.selarrrow.splice(ia,1);}</em></p>
<p>The above line can&#39;t just be removed either as it will leave wrong values for getGridParam(&#39;selarrrow&#39;) after row removal (further deletion of records at the grid will not clear it&#39;s id&#39;s from selarrrow).</p>
<p>I hope the bug gets fixed soon. For now as temporary fix, I just issue a trigger &#8220;reloadGrid&#8221; to get a fresh updated grid data but with the expense of an extra query hit.</p>
<p>By the way, I&#39;m using version 3.4.3</p>
<p>bonjo</p>
]]></description>
        	        	<pubDate>Fri, 20 Mar 2009 15:11:09 +0200</pubDate>
        </item>
</channel>
</rss>