<?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: setSelection function does not work in the next row click</title>
	<link>http://www.trirand.com/blog/?page_id=393/bugs/setselection-function-does-not-work-in-the-next-row-click</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/setselection-function-does-not-work-in-the-next-row-click/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>marcosvitali on setSelection function does not work in the next row click</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/setselection-function-does-not-work-in-the-next-row-click#p9767</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/setselection-function-does-not-work-in-the-next-row-click#p9767</guid>
        	        	<description><![CDATA[<p>&#160;Thank you Tony and Mark!!!</p>
<p>The problem is solved now 🙂 🙂</p>
]]></description>
        	        	<pubDate>Wed, 16 Sep 2009 07:00:19 +0300</pubDate>
        </item>
        <item>
        	<title>tony on setSelection function does not work in the next row click</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/setselection-function-does-not-work-in-the-next-row-click#p9745</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/setselection-function-does-not-work-in-the-next-row-click#p9745</guid>
        	        	<description><![CDATA[<p>Thanks marcosvitali,<strong></strong></p>
<p>Thanks Mark,</p>
<p>The correction is in GitHub.</p>
<p>Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Tue, 15 Sep 2009 12:49:15 +0300</pubDate>
        </item>
        <item>
        	<title>markw65 on setSelection function does not work in the next row click</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/setselection-function-does-not-work-in-the-next-row-click#p9744</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/setselection-function-does-not-work-in-the-next-row-click#p9744</guid>
        	        	<description><![CDATA[<p>I see. Sorry, now I see the problem 🙂</p>
</p>
<p>First, note that the "id" in your data is ignored. The first parameter to addRowData determines the id.</p>
</p>
<p>But thats not the problem, because they are the same thing (i+1 == mydata[i].id).</p>
</p>
<p>The problem is that rowid's are strings. addRowData correctly converts an integer to a string before using it as an id, but setSelection does not.</p>
</p>
<p>I think it will work if you use </p>
<p>&#160; </p>
<p><input type='button' class='sfcodeselect' name='sfselectit879' value='Select Code' data-codeid='sfcode879' /></p>
<div class='sfcode' id='sfcode879'>jQuery(â€#Table1â€³).setSelection("2");</div>
</p>
<p>or</p>
</p>
<p>&#160; </p>
<p><input type='button' class='sfcodeselect' name='sfselectit1614' value='Select Code' data-codeid='sfcode1614' /></p>
<div class='sfcode' id='sfcode1614'>jQuery(â€#Table1â€³).setSelection(2+"");</div>
</p>
<p>Mark</p></p>
]]></description>
        	        	<pubDate>Tue, 15 Sep 2009 11:46:41 +0300</pubDate>
        </item>
        <item>
        	<title>markw65 on setSelection function does not work in the next row click</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/setselection-function-does-not-work-in-the-next-row-click#p9743</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/setselection-function-does-not-work-in-the-next-row-click#p9743</guid>
        	        	<description><![CDATA[<p>I see. Sorry, now I see the problem 🙂</p>
</p>
<p>First, note that the "id" in your data is ignored. The first parameter to addRowData determines the id.</p>
</p>
<p>But thats not the problem, because they are the same thing (i+1 == mydata[i].id).</p>
</p>
<p>The problem is that rowid&#39;s are strings. addRowData correctly converts an integer to a string before using it as an id, but setSelection does not.</p>
</p>
<p>I think it will work if you use</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit8636' value='Select Code' data-codeid='sfcode8636' /></p>
<div class='sfcode' id='sfcode8636'>jQuery(&#8221;#Table1&#8243;).setSelection("2");</div>
</p>
<p>or</p>
<p><input type='button' class='sfcodeselect' name='sfselectit5657' value='Select Code' data-codeid='sfcode5657' /></p>
<div class='sfcode' id='sfcode5657'>jQuery(&#8221;#Table1&#8243;).setSelection(2+"");</div>
</p>
<p>Mark</p></p>
]]></description>
        	        	<pubDate>Tue, 15 Sep 2009 11:46:35 +0300</pubDate>
        </item>
        <item>
        	<title>marcosvitali on setSelection function does not work in the next row click</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/setselection-function-does-not-work-in-the-next-row-click#p9740</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/setselection-function-does-not-work-in-the-next-row-click#p9740</guid>
        	        	<description><![CDATA[<p>I am using the correct RowID (I think so)</p>
</p>
<p>For example this code does not work, I&#160;will get that error next time you click on a row.</p>
<p>Please, help me. What is my mistake? in this JSON ROW&#160;{id:"1",FirstName:"Mark",LastName:"Wise"} is this &#160;id:"1" the rowID ??</p>
</p>
<p>The row is selected correctly, the problem is when I click on another row in te grid.</p>
</p>
<p>Thank you</p>
</p>
<p><span> </span>&#60;script type="text/javascript"&#62;<span> </span> &#160; &#160;</p>
<p><span> </span>$(document).ready(function(){</p>
<p><span> </span></p>
<p><span> </span> &#160; &#160; &#160; &#160; CreateGrid();<span> </span> &#160; &#160;</p>
<p><span> </span>});</p>
<p><span> </span></p>
<p><span> </span>function CreateGrid()&#160;</p>
<p><span> </span>{</p>
<p><span> </span></p>
<p><span> </span>jQuery("#Table1").jqGrid({</p>
<p><span> </span> &#160; &#160;datatype: "local",</p>
<p><span> </span> &#160; &#160;colNames:[&#39;FirstName&#39;,&#39;LastName&#39;],</p>
<p><span> </span> &#160; &#160;colModel:[</p>
<p><span> </span> &#160; &#160; &#160; &#160;{name:&#39;FirstName&#39;,index:&#39;FirstName&#39;, width:130},</p>
<p><span> </span> &#160; &#160; &#160; &#160;{name:&#39;LastName&#39;,index:&#39;LastName&#39;, width:130}<span> </span> &#160; &#160;<span> </span></p>
<p><span> </span> &#160; &#160;],</p>
<p><span> </span> &#160; &#160;pager: jQuery(&#39;#Table1Div1&#39;),</p>
<p><span> </span> &#160; &#160;rowNum:2,</p>
<p><span> </span> &#160; &#160;rowList:[10,20,30],</p>
<p><span> </span> &#160; &#160;caption: "Data",</p>
<p><span> </span>sortname: &#39;FirstName&#39;,</p>
<p>&#160;&#160; &#160;<span> </span>viewrecords: true</p>
<p><span> </span>});</p>
</p>
<p><span> </span>var mydata = [</p>
<p><span> </span>{id:"1",FirstName:"Mark",LastName:"Wise"},</p>
<p><span> </span>{id:"2",FirstName:"Jhon",LastName:"Harris"}<span> </span></p>
<p><span> </span>];</p>
<p><span> </span>for(var i=0;i&#60;=mydata.length;i++)</p>
<p><span> </span>jQuery("#Table1").addRowData(i+1,mydata[i]);</p>
</p>
<p><span> </span>jQuery("#Table1").setSelection(2);</p>
<p><span> </span></p>
<p><span> </span>}<span> </span> &#160; &#160; &#160; &#160;<span> </span></p>
<p><span> </span>&#60;/script&#62;<span> </span></p></p>
]]></description>
        	        	<pubDate>Tue, 15 Sep 2009 10:32:15 +0300</pubDate>
        </item>
        <item>
        	<title>markw65 on setSelection function does not work in the next row click</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/setselection-function-does-not-work-in-the-next-row-click#p9737</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/setselection-function-does-not-work-in-the-next-row-click#p9737</guid>
        	        	<description><![CDATA[<p><input type='button' class='sfcodeselect' name='sfselectit7896' value='Select Code' data-codeid='sfcode7896' /></p>
<div class='sfcode' id='sfcode7896'>2) jQuery(&#8221;#Table1&#8243;).setSelection(1);</div>
</p>
<p>setSelection takes a rowID, not a row index. If the ID you pass in is not the ID of an existing row, you will get this error next time you click on a row, as you describe.</p>
</p>
<p>It looks like it would be a good idea for the grid to check that the ID is valid - but you still need to fix your code if you want setSelection to <em>do </em>anything...</p>
</p>
<p>Mark</p>
]]></description>
        	        	<pubDate>Tue, 15 Sep 2009 09:02:47 +0300</pubDate>
        </item>
        <item>
        	<title>marcosvitali on setSelection function does not work in the next row click</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/setselection-function-does-not-work-in-the-next-row-click#p9732</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/setselection-function-does-not-work-in-the-next-row-click#p9732</guid>
        	        	<description><![CDATA[<p>Tony thank&#39;s for your answer but the same problem happens. 🙁</p>
<p>The grid works perfect only I have a problems when use the method "setSelection" in any grid (JSON, XML, LOCAL with array) always an exepetion happens when I click in the row after use "setSelection", in all navigators Explorer, chrome, firefox.</p>
<p>To reproduce this error you can follow this steps:</p>
<p>1) Use setSelection method in any grid</p>
<p>2) After click in any row in the grid</p>
<p>3) An exception happens 🙁</p>
<p>I love this grid 😀 but i need to select the first row in the grid when my application started..</p>
<p>Thank&#39;s a lot.</p>
<p>Marcos.</p></p>
]]></description>
        	        	<pubDate>Tue, 15 Sep 2009 06:32:44 +0300</pubDate>
        </item>
        <item>
        	<title>tony on setSelection function does not work in the next row click</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/setselection-function-does-not-work-in-the-next-row-click#p9704</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/setselection-function-does-not-work-in-the-next-row-click#p9704</guid>
        	        	<description><![CDATA[<p>Hello</p>
<p>Correct first this error and try</p>
<p>&#160;&#160; colModel:[</p>
<div><span> </span> &#160; &#160; &#160; &#160;{name:&#39;Nombre&#39;,index:&#39;Nombre&#39;, width:130},</div>
<div><span> </span> &#160; &#160; &#160; &#160;{name:&#39;Direccion&#39;,index:&#39;Direccion&#39;, width:130},</div>
<div><span> </span> &#160; &#160;<span> </span>{name:&#39;Telefono&#39;,index:&#39;Telefono&#39;, width:120},<span> </span></div>
<div><span> </span> &#160; &#160;<span> </span>{name:&#39;Distancia&#39;,index:&#39;Distancia&#39;, width:100},<strong>&#60;---- Error comma<span> </span></strong></div>
<div><strong><span> </span> </strong>&#160; &#160;],</div>
<p><span> </span></p>
]]></description>
        	        	<pubDate>Mon, 14 Sep 2009 22:12:29 +0300</pubDate>
        </item>
        <item>
        	<title>marcosvitali on setSelection function does not work in the next row click</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/setselection-function-does-not-work-in-the-next-row-click#p9692</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/setselection-function-does-not-work-in-the-next-row-click#p9692</guid>
        	        	<description><![CDATA[</p>
<p>Hi Tony,</p>
</p>
<p>I am from Argentina sory for my english 😀</p>
</p>
<p>I use jqGrid 3.5 and jQuery 1.3.2</p>
<p>The setSelection function does not work.&#160;</p>
</p>
<p>The problem is if you use "setSelection" function the next click on the row fails because "tr#" + X doesnt exists</p>
</p>
<p>Steps:</p>
</p>
<p>1) Load any jqgrid</p>
<p>2) jQuery("#Table1").setSelection(1);</p>
<p>3) I click a row</p>
<p>4) I have an error in the "setSelection : function" in "grid.base.js"</p>
<p>Line:</p>
<p>$("tr#"+$t.p.selrow.replace(".", "\\\\."),$t.grid.bDiv).removeClass("ui-state-highlight").attr("aria-selected","false");</p>
<div></div>
<div>My example code is:</div>
<div></div>
<div>
<div><span> </span>function CreateGrid()&#160;</div>
<div><span> </span>{</div>
<div><span> </span></div>
<div><span> </span>jQuery("#Table1").jqGrid({</div>
<div><span> </span> &#160; &#160;datatype: "local",</div>
<div><span> </span> &#160; &#160;colNames:[&#39;Nombre&#39;,&#39;Direccion&#39;, &#39;Telefono&#39;, &#39;Distancia&#39;],</div>
<div><span> </span> &#160; &#160;colModel:[</div>
<div><span> </span> &#160; &#160; &#160; &#160;{name:&#39;Nombre&#39;,index:&#39;Nombre&#39;, width:130},</div>
<div><span> </span> &#160; &#160; &#160; &#160;{name:&#39;Direccion&#39;,index:&#39;Direccion&#39;, width:130},</div>
<div><span> </span> &#160; &#160;<span> </span>{name:&#39;Telefono&#39;,index:&#39;Telefono&#39;, width:120},<span> </span></div>
<div><span> </span> &#160; &#160;<span> </span>{name:&#39;Distancia&#39;,index:&#39;Distancia&#39;, width:100},<span> </span> &#160; &#160;<span> </span></div>
<div><span> </span> &#160; &#160;],</div>
<div><span> </span> &#160; &#160;pager: jQuery(&#39;#Table1Div1&#39;),</div>
<div><span> </span> &#160; &#160;rowNum:5,</div>
<div><span> </span> &#160; &#160;rowList:[10,20,30],</div>
<div><span> </span> &#160; &#160;caption: "Datos",</div>
<div><span> </span>success: termino</div>
<div><span> </span>});</div>
<div></div>
<div><span> </span>var mydata = [</div>
<div><span> </span>{id:"1",Nombre:"Marcos1",Direccion:"Lavalle 100",Telefono:"2322-3232",Distancia:"4000"},</div>
<div><span> </span>{id:"2",Nombre:"Marcos2",Direccion:"Lavalle 100",Telefono:"2322-3232",Distancia:"4000"},</div>
<div><span> </span>{id:"3",Nombre:"Marcos3",Direccion:"Lavalle 100",Telefono:"2322-3232",Distancia:"4000"},</div>
<div><span> </span>{id:"4",Nombre:"Marcos4",Direccion:"Lavalle 100",Telefono:"2322-3232",Distancia:"4000"},</div>
<div><span> </span>{id:"5",Nombre:"Marcos5",Direccion:"Lavalle 100",Telefono:"2322-3232",Distancia:"4000"}<span> </span></div>
<div><span> </span>];</div>
<div><span> </span>for(var i=0;i&#60;=mydata.length;i++)</div>
<div><span> </span>jQuery("#Table1").addRowData(i+1,mydata[i]);</div>
<div></div>
<div><span> </span>jQuery("#Table1").setSelection(1);<span> </span></div>
<div><span> </span>}</div>
</div>
<div></div>
<div>Thank&#39;s in advance Marcos</div>
<div></div>
]]></description>
        	        	<pubDate>Mon, 14 Sep 2009 08:56:06 +0300</pubDate>
        </item>
</channel>
</rss>