<?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: Dynamically add button to grid to trigger form edit</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/dynamically-add-button-to-grid-to-trigger-form-edit</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/dynamically-add-button-to-grid-to-trigger-form-edit/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>Renso on Dynamically add button to grid to trigger form edit</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/dynamically-add-button-to-grid-to-trigger-form-edit#p18271</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/dynamically-add-button-to-grid-to-trigger-form-edit#p18271</guid>
        	        	<description><![CDATA[<p>I tried the Demo example on how to add buttons for CRUD operations (Custom Edit) but it does not seem to work for me so I created the following solution but it messes up the id of the row being sent to the server when editing. What am I doing wrong? Also the demo version "Custom Edit" getDataIDs does not return a list of ids as I expected but the table itself, not sure what that is all about, any ideas?</p>
</p>
<p>In this example "item" is a reference to my grid.</p>
<p><input type='button' class='sfcodeselect' name='sfselectit1544' value='Select Code' data-codeid='sfcode1544' /></p>
<div class='sfcode' id='sfcode1544'>gridComplete: function() {<br /> &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var rows = $(item).jqGrid(&#39;getRowData&#39;);<br /> &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; for (var i = 0; i &#60; <strong>rows[0].rows.length</strong>;  i++) {<br /> &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var row = rows[0].rows[i];<br /> &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var idx = row.id;<br /> &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (!$(row).hasClass(&#39;jqgrow&#39;) &#38;&#38;  !$(row).hasClass(&#39;alt&#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; continue;<br /> &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var be = &#34;&#60;input style=&#39;height:22px;width:35px;&#39;  type=&#39;button&#39; id=&#39;editAddress&#34; + idx + &#34;&#39; value=&#39;Edit&#39; /&#62;&#34;;<br /> &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $(item).setRowData(idx, { act: be });<br /> &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $(&#39;#editAddress&#39; + idx).click(function() {<br /> &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <strong>$(item).<span style=&#34;&#34;color:&#34;>editGridRow</span></strong><strong>($(this).parent().parent(&#39;tr&#39;).attr(&#39;id&#39;));</strong><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; }<br /> &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; },</div></p>
]]></description>
        	        	<pubDate>Tue, 29 Jun 2010 14:36:23 +0300</pubDate>
        </item>
</channel>
</rss>