<?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: Prevent adding empty row after execution of afterSubmit</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/prevent-adding-empty-row-after-execution-of-aftersubmit</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/prevent-adding-empty-row-after-execution-of-aftersubmit/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>Luigino on Prevent adding empty row after execution of afterSubmit</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/prevent-adding-empty-row-after-execution-of-aftersubmit#p26265</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/prevent-adding-empty-row-after-execution-of-aftersubmit#p26265</guid>
        	        	<description><![CDATA[<p>Hello tony and everyone,</p>
</p>
<p>I have a grid where I put a custom button in the navgrid for inserting totally different data in another table so I used editGridRow("new",&#8230;) where in the php url I just post data to a different table. Actually I am stuck with the issue if I submit the form, even if I settled reloadAfterSubmit:false, it add a new empty row in the grid&#8230;</p>
<p>You can see the piece of code here:</p>
<p><input type='button' class='sfcodeselect' name='sfselectit4176' value='Select Code' data-codeid='sfcode4176' /></p>
<div class='sfcode' id='sfcode4176'>
<p>jQuery(&#34;#&#34;+child_table_id).navButtonAdd(<br />&#160;&#160; &#160;&#34;#&#34;+pager_id,<br />&#160;&#160; &#160;{<br />&#160;&#160; &#160;&#160;&#160; &#160;caption:&#34;Insert&#34;,buttonicon:&#34;ui-icon-arrow-1-se&#34;,<br />&#160;&#160; &#160;&#160;&#160; &#160;onClickButton:function(){ <br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;var rows = jQuery(&#34;#&#34;+child_table_id).getRowData(); <br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;if ( rows.length != 0 ) { <br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;jQuery(&#34;#&#34;+child_table_id).editGridRow(&#34;new&#34;,{height:140,width:420,url:&#34;<a href="http://&#8230;/edit_datatable.php?table_name=mytable&#038;fact=insert&#038;q=1&#038;flag=yes&#038;ref_id=&#34;+id_row" rel="nofollow" target="_blank"><a href="http://&#8230;/edit_datatable" rel="nofollow">http://&#8230;/edit_datatable</a>.....ot;+id_row</a>,<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;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;reloadAfterSubmit:false,<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;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;recreateForm:true,<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;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;closeOnEscape:true,<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;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;closeAfterAdd:true,<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;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;addCaption:&#39;Insert&#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;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;savekey: [true,13],<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;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;bSubmit:&#39;Save&#39;,&#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;&#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;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;afterSubmit:function(response, postdata){ alert(&#39;inserting to a total different table&#8230;&#39;); return {0:true} } <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;&#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;}<br />&#160;&#160; &#160;&#160;&#160; &#160;},<br />&#160;&#160; &#160;&#160;&#160; &#160;position:&#34;last&#34;,<br />&#160;&#160; &#160;&#160;&#160; &#160;title:&#34;Insert new step&#8230;&#34;,<br />&#160;&#160; &#160;&#160;&#160; &#160;cursor:&#34;pointer&#34;<br />&#160;&#160; &#160;});</p>
</p>
</div>
<p>I tried even to add:</p>
</p>
<p>onClickButton:function(){ $("#"+child_table_id).setGridParam({ datatype: &#39;local&#39; }); }</p>
<p>afterSubmit:function(response, postdata){ return {0:true} },</p>
<p>onclickSubmit : function(params, posdata) {return {0:true} },</p>
<p>afterComplete:function(response, postdata, formid) { $("#"+child_table_id).setGridParam({ datatype: &#39;json&#39; }); }</p>
</p>
<p>but it added anyway a row in the grid...</p>
</p>
<p>So how I can prevent&#160; jqGrid to add a new empty grid and refreshing the grid?&#8230;</p>
</p>
<p>thanks a lot to everyone</p>
<p>Ciao,</p>
<p>Luigi</p>
]]></description>
        	        	<pubDate>Fri, 30 Mar 2012 13:54:58 +0300</pubDate>
        </item>
</channel>
</rss>