<?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: How can I get the Row Id of SubGrid</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/how-can-i-get-the-row-id-of-subgrid</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/help/how-can-i-get-the-row-id-of-subgrid/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>mjoudtn on How can I get the Row Id of SubGrid</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/how-can-i-get-the-row-id-of-subgrid#p21747</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/how-can-i-get-the-row-id-of-subgrid#p21747</guid>
        	        	<description><![CDATA[<p>Hi everyBody,</p>
</p>
<p>I use the Grid of the jqgrid with a &#39;subGrid&#39;, this the code:</p>
</p>
<p>jQuery("#listeBudget").jqGrid({<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;url:&#39;listBudget.do?delais=&#39;+currentYear,<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;datatype: "json",<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;height: 400,&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;colNames:[&#39;Actions&#39;,&#39;Code Budget&#39;,&#39;Code Cat&#233;gorie&#39;,&#39;Cat&#233;gorie&#39;,&#39;Montant annuel&#39;,&#39;Fr&#233;quence&#39;,&#39;Janvier&#39;, &#39;F&#233;vrier&#39;,&#39;Mars&#39;, &#39;Avril&#39;, &#39;Mai&#39;, &#39;Juin&#39;, &#39;Juillet&#39;, &#39;Ao&#251;t&#39;, &#39;Septembre&#39;, &#39;Octobre&#39;, &#39;Novembre&#39;, &#39;D&#233;cembre&#39;],</p>
<p>&#8230;&#8230;..</p>
<p>for(var i=0;i &#60; ids.length;i++){<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160; var cl = ids[i]; <br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160; id_categorie = cl;&#160; <br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160; be = "&#60;input style=&#39;height:22px;width:20px;&#39; disabled=&#39;disabled&#39; id=&#39;tbuttonEdit"+cl+"&#39; type=&#39;button&#39; value=&#39;E&#39; onclick="jQuery(&#39;#listeBudget&#39;).editRow(&#39;"+cl+"&#39;,&#39; &#39;,afterEdit);" /&#62;";<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160; se = "&#60;input name=&#39;send&#39; disabled=&#39;disabled&#39; style=&#39;height:22px;width:20px;&#39; id=&#39;tbuttonSend"+cl+"&#39; type=&#39;button&#39; value=&#39;V&#39; "+<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160; "onclick=jQuery(&#39;#listeBudget&#39;).jqGrid(&#39;saveRow&#39;,&#39;"+cl+"&#39;,reload,&#39;addCategorieBudget.do?id_categorie="+id_categorie+"&#38;delais="+$(&#39;#delais&#39;).val()+"&#39;); /&#62;";<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160; ce = "&#60;input style=&#39;height:22px;width:20px;&#39; disabled=&#39;disabled&#39; id=&#39;tbuttonCancel"+cl+"&#39; type=&#39;button&#39; value=&#39;X&#39; onclick="jQuery(&#39;#listeBudget&#39;).restoreRow(&#39;"+cl+"&#39;,reload);" /&#62;";<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160; jQuery("#listeBudget").jqGrid(&#39;setRowData&#39;,ids[i],{act:be+se+ce}, &#39;mybold&#39;);<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160; jQuery("#listeBudget").jqGrid(&#39;setCell&#39;,ids[i],&#39;mntAnnuelle&#39;,&#39;&#39;,{&#39;font-weight&#39;:&#39;bold&#39;});<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160; jQuery("#listeBudget").attr(&#39;title&#39;, &#39;(Editer, Valider, Annuler)&#39;);<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;}</p>
<p>&#8230;&#8230;..</p>
<p><strong>subGridRowExpanded: function(subgrid_id, row_id) { </strong><br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160; var pager_id; <br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160; subgrid_table_id = subgrid_id+"_t"; <br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160; <br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160; pager_id = "p_"+subgrid_table_id; <br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160; var data = jQuery("#listeBudget").jqGrid(&#39;getRowData&#39;,row_id);<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160; ids = data.code;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160; $("#"+subgrid_id).html("&#60;table id=&#39;"+subgrid_table_id+"&#39; class=&#39;scroll&#39;&#62;&#60;/table&#62;&#60;div id=&#39;"+pager_id+"&#39; class=&#39;scroll&#39;&#62;&#60;/div&#62;"); <br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160; <span style="color: #ff0000;">jQuery("#"+subgrid_table_id).jqGrid({ </span></p>
<p>url:&#39;listSousCategBudget.do?delais=&#39;+delai,<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160; datatype: "json",<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160; postData: {<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160; ids: function() { return ids }<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160; },<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160; colNames:[&#39;Actions&#39;,&#39;Code Budget&#39;,&#39;Sous Cat&#233;gorie&#39;, &#39;Sous cat&#233;gorie&#39;,&#39;Montant annuel&#39;,&#39;Fr&#233;quence&#39;,&#39;Janvier&#39;, &#39;F&#233;vrier&#39;,&#39;Mars&#39;, &#39;Avril&#39;, &#39;Mai&#39;, &#39;Juin&#39;, &#39;Juillet&#39;, &#39;Ao&#251;t&#39;, &#39;Septembre&#39;, &#39;Octobre&#39;, &#39;Novembre&#39;, &#39;D&#233;cembre&#39;],</p>
<p>&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;</p>
<p>gridComplete: function () {</p>
<p>&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160; var grid = $(&#39;#&#39;+subgrid_table_id);<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160; grid.resetSelection();<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160; var id = grid.getDataIDs();<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160; grid.setSelection(id[0]);<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160; &#160;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; <span style="color: #0000ff;">for(var i=0;i &#60; id.length;i++){<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160; var cl = id[i]; <br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160; id_Budgetaire = cl;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160; var sel=$(&#39;#&#39;+subgrid_table_id).jqGrid(&#39;getRowData&#39;,cl);<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160; id_sous_categorie = sel.code;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160; be = "&#60;input style=&#39;height:22px;width:20px;&#39; id=&#39;tbuttonEditSg"+cl+"&#39; type=&#39;button&#39;&#160; value=&#39;E&#39; onclick="jQuery(&#39;#"+subgrid_table_id+"&#39;).editRow(&#39;"+cl+"&#39;);" /&#62;";<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160; se = "&#60;input name=&#39;send&#39; id=&#39;tbuttonSendSg"+cl+"&#39; style=&#39;height:22px;width:20px;&#39; type=&#39;button&#39; value=&#39;V&#39; "+<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160; "onclick=jQuery(&#39;#"+subgrid_table_id+"&#39;).jqGrid(&#39;saveRow&#39;,&#39;"+cl+"&#39;,reload,&#39;addSousCategorieBudget.do?delais="+$("#delais").val()+"&#38;id_sous_categorie="+id_sous_categorie+"&#38;id_Budgetaire="+id_Budgetaire+"&#39;,{id_categorie:"+ids+"}); /&#62;";<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160; &#160;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160; ce = "&#60;input style=&#39;height:22px;width:20px;&#39; id=&#39;tbuttonCancelSg"+cl+"&#39; type=&#39;button&#39; value=&#39;X&#39; onclick="jQuery(&#39;#"+subgrid_table_id+"&#39;).restoreRow(&#39;"+cl+"&#39;);" /&#62;";</span></p>
<p>&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160; jQuery(&#39;#&#39;+subgrid_table_id).jqGrid(&#39;setRowData&#39;,id[i],{act:be+se+ce});<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;jQuery(&#39;#&#39;+subgrid_table_id).jqGrid(&#39;setCell&#39;,id[i],&#39;mntAnnuelle&#39;,&#39;&#39;,{&#39;font-weight&#39;:&#39;bold&#39;});<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;jQuery(&#39;#&#39;+subgrid_table_id).attr(&#39;title&#39;, &#39;(Editer, Valider, Annuler)&#39;);&#160;&#160; &#160;</p>
<p>&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;}<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160; &#160;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;},</p>
<p>&#8230;&#8230;&#8230;&#8230;.</p>
<p>Now, I need to know the id of the subgrid Row from a javascript function, I can&#39;t do it because the name of the subgrid is a var and it&#39;s not recognized by the function.</p>
</p>
<p>I&#39;ve used a function to get the id row of the grid:</p>
</p>
<p>function afterEdit(){</p>
<p>&#160;&#160; &#160;&#160;&#160; &#160;<br />&#160;&#160; &#160;&#160;&#160; &#160;<span style="color: #0000ff;">var cl = $(&#39;#listeBudget&#39;).getGridParam(&#39;selrow&#39;);</span><br />&#160;&#160; &#160;<br />&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;$(&#39;#tbuttonSend&#39;+cl).attr("disabled",false);<br />&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160; &#160;$(&#39;#tbuttonCancel&#39;+cl).attr("disabled",false);<br />&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160; &#160;$(&#39;#tbuttonEdit&#39;+cl).attr("disabled","disabled");<br />&#160;&#160; &#160;<br />&#160;&#160; &#160;&#160;&#160; &#160;<br />&#160;&#160;&#160; }</p>
</p>
<p>But Now I need a solution to do the same work (like afterEdit() function)&#160; with the subgrid</p>
</p>
<p>Thanks</p></p>
]]></description>
        	        	<pubDate>Tue, 18 Jan 2011 15:32:17 +0200</pubDate>
        </item>
</channel>
</rss>