<?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: handling response from 'afterSubmit' method</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/handling-response-from-aftersubmit-method</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/handling-response-from-aftersubmit-method/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>tony on handling response from 'afterSubmit' method</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/handling-response-from-aftersubmit-method#p14998</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/handling-response-from-aftersubmit-method#p14998</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>If you set closeAfterEdit to false (from your example) the dialog will not close after post. If you set it to true the will close if there is no error - in case that afterSubmit check this.</p>
<p>The first parameter in afterSubmit should be true and not number (int) as per your example.</p>
<p>The error information apper at top and not at bottom.</p>
<p>Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Sat, 20 Feb 2010 12:11:47 +0200</pubDate>
        </item>
        <item>
        	<title>mstone42 on handling response from 'afterSubmit' method</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/handling-response-from-aftersubmit-method#p14916</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/handling-response-from-aftersubmit-method#p14916</guid>
        	        	<description><![CDATA[<p>I&#39;m having a problem with handling the server response from an edit event.&#160; Ideally, what I&#39;d like to have happen is that on a successful transaction, the edit form simply closes and the grid is updated; if an error occurs during the update, the edit form should stay open, and the error message appear on the form (e.g. bottominfo).&#160; However, I&#39;d settle for leaving the form open regardless of the result, and print the result message either way.&#160; I&#39;ve got the form working as far as updating the database, but I can&#39;t find where the &#39;afterSubmit&#39; function is sending the result array.&#160; None of the examples in the demo pack illustrate this feature, and I haven&#39;t been able to find anything helpful in the forums.</p>
<p>Here&#39;s my grid so far:</p>
<p><span style="color: #0000ff;">&#160;&#160; &#160;$("#list").jqGrid({<br />&#160;&#160; &#160;&#160;&#160; &#160;url:&#39;data.php&#39;,<br />&#160;&#160; &#160;&#160;&#160; &#160;datatype: "json",<br />&#160;&#160; &#160;&#160;&#160; &#160;mtype: "POST",<br />&#160;&#160; &#160;&#160;&#160; &#160;colNames:[...],<br />&#160;&#160; &#160;&#160;&#160; &#160;colModel:[...],<br />&#160;&#160; &#160;&#160;&#160; &#160;editurl:"data_edit.php" <br />&#160;&#160; &#160;});<br />&#160;&#160; &#160;$("#editdata").click(function(){<br />&#160;&#160; &#160;&#160;&#160; &#160;var id = jQuery("#list").jqGrid(&#39;getGridParam&#39;,&#39;selrow&#39;);<br />&#160;&#160; &#160;&#160;&#160; &#160;var options = {<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;bottominfo: "",<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;modal: true,reloadAfterSubmit:true, closeOnEscape:true,closeAfterEdit:false, <br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;afterSubmit: function(response,postdata){ return GetResponseData(response); }<br />&#160;&#160; &#160;&#160;&#160; &#160;};<br />&#160;&#160; &#160;&#160;&#160; &#160;if(id != null ) jQuery("#list").jqGrid(&#39;editGridRow&#39;,id,options);<br />&#160;&#160; &#160;&#160;&#160; &#160;else alert("Please Select Row");<br />&#160;&#160; &#160;});<br />&#160;&#160; &#160;function GetResponseData (resp) {<br />&#160;&#160; &#160;&#160;&#160; &#160;var json=resp.responseText;&#160; //format is {errno:(int),errmsg:"",query:""}<br />&#160;&#160; &#160;&#160;&#160; &#160;var result=eval("("+json+")");<br />&#160;&#160; &#160;&#160;&#160; &#160;return [result.errno,result.error,""];<br />&#160;&#160; &#160;}</span></p>
<p>I know that the value of the array returned from the &#39;afterSubmit&#39; event needs to be the assigned to &#39;bottominfo&#39; property, something along the lines of:</p>
<p><span style="color: #0000ff;">&#160;&#160; &#160;var z = ???; // array sent from afterSubmit<br />&#160;&#160; &#160;$(&#39;.bottominfo&#39;).text("ERROR [" + z.errno + "] " + z.errmsg);<br /></span><br />but I can&#39;t fingure out where this needs to go.</p>
<p>Another problem I&#39;ve just realized is that there is no &#39;bottominfo&#39; property associated with the &#39;delGridRow&#39; method.&#160; I suppose I could overwrite the table row which has the &#39;delmsg&#39; class, which takes us right back to the problem of accessing the &#39;afterSubmit&#39; array.</p>
<p>HELP!!!</p>
<p>Thanks,<br />Mitch</p>
]]></description>
        	        	<pubDate>Thu, 18 Feb 2010 00:34:29 +0200</pubDate>
        </item>
</channel>
</rss>