<?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: apparent afterSubmit inconsistent behaviour</title>
	<link>http://www.trirand.com/blog/?page_id=393/bugs/apparent-aftersubmit-inconsistent-behaviour</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/apparent-aftersubmit-inconsistent-behaviour/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>tony on apparent afterSubmit inconsistent behaviour</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/apparent-aftersubmit-inconsistent-behaviour#p9746</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/apparent-aftersubmit-inconsistent-behaviour#p9746</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>1. maybe this will work&#160; afterSubmit:function(response,postdata){alert(<strong>response.responseText</strong>); <strong>return [true,"",""]</strong>;}}</p>
<p>2. this event should return array with special values - see docs</p>
<p>Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Tue, 15 Sep 2009 12:53:31 +0300</pubDate>
        </item>
        <item>
        	<title>paolo on apparent afterSubmit inconsistent behaviour</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/apparent-aftersubmit-inconsistent-behaviour#p9722</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/apparent-aftersubmit-inconsistent-behaviour#p9722</guid>
        	        	<description><![CDATA[<p>i think to have a similar error.</p>
<p>afterSubmit event seems to happen before server calling and i can&#39;t receive response data and i&#39;ve verified that</p>
<p>jQuery(gridName).editGridRow(&#39;new&#39;,{height:150,reloadAfterSubmit:true,editData:{action:&#39;new&#39;,afterSubmit:function(response,postdata){alert(response)}}});</p>
</p>
<p>return always undefined even if &#160;server call is completed and database updated.</p>
</p>
<p>Paolo.</p>
]]></description>
        	        	<pubDate>Tue, 15 Sep 2009 03:47:08 +0300</pubDate>
        </item>
        <item>
        	<title>tony on apparent afterSubmit inconsistent behaviour</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/apparent-aftersubmit-inconsistent-behaviour#p2822</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/apparent-aftersubmit-inconsistent-behaviour#p2822</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>Thank you very much for this. It is true.</p>
<p>We should have working solutions 🙂 and I will implement your</p>
<p>correction.</p>
<p>Best Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Fri, 31 Oct 2008 01:26:04 +0200</pubDate>
        </item>
        <item>
        	<title>cjorata on apparent afterSubmit inconsistent behaviour</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/apparent-aftersubmit-inconsistent-behaviour#p2803</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/apparent-aftersubmit-inconsistent-behaviour#p2803</guid>
        	        	<description><![CDATA[<p>Ok after some research i found what could be the reason of this issue:</p>
</p>
<p>the reason is how editGridRow is implemented :</p>
</p>
<p>editGridRow : function(rowid, p){<br />&#160;&#160;&#160; &#160;&#160;&#160; p = $.extend({<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; // blah blah blah<br />&#160;&#160;&#160; &#160;&#160;&#160; }, $.jgrid.edit, p &#124;&#124; {});<br />&#160;&#160;&#160; &#160;&#160;&#160; return this.each(function(){<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; // various references to p</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $.ajax( // blah blah,</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; complete:function(a,b){</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // again references to p<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if ( typeof p.afterSubmit === &#39;function&#39; )</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;&#160;&#160;&#160;&#160; p.afterSubmit(a,b);</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>
<p>to be short : you can&#39;t reference p safely inside this.each and inside complete because it&#39;s an out of scope variable, instead if you do something like this (which is pretty raw i know, but it works) ...</p>
<p>var CJ_customglobalvar = null;</p>
<p>editGridRow : function(rowid, p){<br /> &#160;&#160;&#160; &#160;&#160;&#160; p = $.extend({<br /> &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; // blah blah blah<br /> &#160;&#160;&#160; &#160;&#160;&#160; }, $.jgrid.edit, p &#124;&#124; {});<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; CJ_customglobalvar = p;<br /> &#160;&#160;&#160; &#160;&#160;&#160; return this.each(function(){<br /> &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; // various references to p -&#62; become references to CJ_customglobalvar</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $.ajax( // blah blah,</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; complete:function(a,b){</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // again references to p becomes references to CJ_customglobalvar<br /> &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if ( typeof CJ_customglobalvar.afterSubmit === &#39;function&#39; )</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;&#160;&#160;&#160;&#160; CJ_customglobalvar.afterSubmit(a,b);</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>
</p>
<p>.... so i hope to have suggested you some kind of solution ... for me it worked out ...</p>
<p>Cheers</p>
<p>CJ</p>
]]></description>
        	        	<pubDate>Wed, 29 Oct 2008 18:00:51 +0200</pubDate>
        </item>
        <item>
        	<title>tony on apparent afterSubmit inconsistent behaviour</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/apparent-aftersubmit-inconsistent-behaviour#p2744</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/apparent-aftersubmit-inconsistent-behaviour#p2744</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>Thank you. Definitley I will check this.</p>
<p>Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Wed, 29 Oct 2008 02:10:06 +0200</pubDate>
        </item>
        <item>
        	<title>cjorata on apparent afterSubmit inconsistent behaviour</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/apparent-aftersubmit-inconsistent-behaviour#p2699</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/apparent-aftersubmit-inconsistent-behaviour#p2699</guid>
        	        	<description><![CDATA[<p>Maybe i&#39;m wrong, but i&#39;m experiencing inconsistent afterSubmit behaviour using</p>
<p>[jqgrid code].navGrid(<br />"#pagerid",{add:true,edit:true,del:true,search:false,refresh:false},<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;&#160; &#160;&#160;&#160; reloadAfterSubmit:true,<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; closeAfterEdit:true,<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; beforeShowForm:function(){alert("beforeShowForm edit");},<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; afterSubmit:function(r,data){alert(&#39;afterSubmit edit&#39;);}<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; ,<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; &#160;&#160;&#160; reloadAfterSubmit:true,<br />&#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; beforeShowForm:function(){alert("beforeShowForm new");},<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; afterSubmit:function(r,data){alert(&#39;afterSubmit new&#39;);}<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; }<br />&#160;&#160;&#160; );</p>
<p>When i click on the edit button i get as expected</p>
<p>1) alert("beforeShowForm edit");<br />2) alert(&#39;afterSubmit edit&#39;);</p>
<p>but when i click on the new button i get</p>
<p>1) alert("beforeShowForm new");<br />2) alert(&#39;afterSubmit edit&#39;); &#60;- i expected an alert(&#39;afterSubmit new&#39;);</p>
<p>trying the opposite (first hit the new button, than the edit button) you can experience the opposite, this time</p>
<p>1) alert("beforeShowForm new");<br /> 2) alert(&#39;afterSubmit new&#39;);</p>
<p> but when i click on the new button i get</p>
<p> 1) alert("beforeShowForm edit");<br /> 2) alert(&#39;afterSubmit new&#39;);</p>
<p>... so to make a long story short, it seems that the once the afterSubmit event is initialized with a function you can&#39;t change it ...</p>
<p>Maybe someone of you crashed on this problem before ...</p>
<p>I&#39;m trying it on IE7, windows XP, latest jqgrid release (3.3).</p>
<p>Hope i&#39;m wrong and this is not a bug ...</p>
<p>Cheers</p>
<p>CJ</p>
]]></description>
        	        	<pubDate>Sat, 25 Oct 2008 13:05:51 +0300</pubDate>
        </item>
</channel>
</rss>