<?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: Form editing add row, use '0' instead of '_empty'</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/form-editing-add-row-use-0-instead-of-_empty</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/form-editing-add-row-use-0-instead-of-_empty/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>jackysee on Form editing add row, use '0' instead of '_empty'</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/form-editing-add-row-use-0-instead-of-_empty#p15054</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/form-editing-add-row-use-0-instead-of-_empty#p15054</guid>
        	        	<description><![CDATA[<p>Thx, I&#39;ve done it by:</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit8930' value='Select Code' data-codeid='sfcode8930' /></p>
<div class='sfcode' id='sfcode8930'>serializeEditData: function(data){ <br />&#160;&#160; &#160;return $.param($.extend({}, data, {id:0}));<br />}</div>
]]></description>
        	        	<pubDate>Mon, 22 Feb 2010 19:49:41 +0200</pubDate>
        </item>
        <item>
        	<title>OlegK on Form editing add row, use '0' instead of '_empty'</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/form-editing-add-row-use-0-instead-of-_empty#p15041</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/form-editing-add-row-use-0-instead-of-_empty#p15041</guid>
        	        	<description><![CDATA[<p>Hi!</p>
</p>
<p>First of all about serializeEditData(). If you look inside of postIt() you can see</p>
<p>$.ajax( $.extend({<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;url:gurl,<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;type: rp_ge.mtype,<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;data: $.isFunction(rp_ge.serializeEditData) ? rp_ge.serializeEditData(postdata) :&#160; postdata,<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;complete:function(data,Status){</p>
<p>&#8230;</p>
<p>So if you don&#39;t modify postdata inside of your serializeEditData implementation, but make a copy (a clone) of all data instead, makes modification of the copy of postdata, and then return the copy, you receive NO side effects.</p>
<p>By the way, to make a copy of data, which has no subobjects you can do following</p>
<p>&#160;&#160;&#160; var destObj = {};<br />&#160;&#160;&#160; for (prop in srcObj)<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; destObj[prop] = srcObj[prop];</p>
<p>Probably exist a nice version to produce a clone of data, but this one works.</p>
<p>Problem with "closeAfterAdd: true", which you describe, is an old bug inside of jqGrid. I had the problem also. But if you set both "closeAfterAdd: true" and "closeAfterEdit: true" everything will work. In all my project I use either both closeAfterAdd and closeAfterEdit as true or both as false, so I have no real problem. But to fix the problem, place it in the forum for bugs.</p>
</p>
<p>Best regards<br />Oleg</p>
]]></description>
        	        	<pubDate>Mon, 22 Feb 2010 13:02:13 +0200</pubDate>
        </item>
        <item>
        	<title>jackysee on Form editing add row, use '0' instead of '_empty'</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/form-editing-add-row-use-0-instead-of-_empty#p15037</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/form-editing-add-row-use-0-instead-of-_empty#p15037</guid>
        	        	<description><![CDATA[<p>Digging into the source code found that in postIt(), it has something like:</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit3137' value='Select Code' data-codeid='sfcode3137' /></p>
<div class='sfcode' id='sfcode3137'>// the action is add<br />if(postdata.id==&#34;_empty&#34; ) {&#160;</div>
<p>which occurs after serializeEditData, so I changed it to</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit4891' value='Select Code' data-codeid='sfcode4891' /></p>
<div class='sfcode' id='sfcode4891'>// the action is add<br />if(postdata.oper==&#34;add&#34; ) {&#160;&#160;</div>
<p>and closeAfterAdd works as expected. &#160;Any other impact if I apply this change?</p>
]]></description>
        	        	<pubDate>Mon, 22 Feb 2010 06:29:42 +0200</pubDate>
        </item>
        <item>
        	<title>jackysee on Form editing add row, use '0' instead of '_empty'</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/form-editing-add-row-use-0-instead-of-_empty#p15035</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/form-editing-add-row-use-0-instead-of-_empty#p15035</guid>
        	        	<description><![CDATA[<p>I found that there is a side effect either I use onclickSubmit or serializeEditData. In the settings, I have closeAfterAdd: true, but the dialog does not close after add. The code is like:&#160;</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit7377' value='Select Code' data-codeid='sfcode7377' /></p>
<div class='sfcode' id='sfcode7377'>clearAfterAdd: true, <br />closeAfterAdd: true,&#160;<br />url: &#39;/remote.rpc?acton=add&#39;,<br />serializeEditData: function(data){ data.id = 0; return $.param(data);} //dialog not close after add</div>
<p>But strangely if I do not modify the &#39;data&#39; object, the dialog can be closed successfully! i.e.</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit7646' value='Select Code' data-codeid='sfcode7646' /></p>
<div class='sfcode' id='sfcode7646'>clearAfterAdd: true,&#160;<br />closeAfterAdd: true,&#160;<br />url: &#39;/remote.rpc?acton=add&#39;,<br />serializeEditData: function(data){ return $.param(data);} //dialog close after add</div>
<p>This is really strange. Any workaround on this?</p>
]]></description>
        	        	<pubDate>Mon, 22 Feb 2010 06:09:33 +0200</pubDate>
        </item>
        <item>
        	<title>OlegK on Form editing add row, use '0' instead of '_empty'</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/form-editing-add-row-use-0-instead-of-_empty#p14952</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/form-editing-add-row-use-0-instead-of-_empty#p14952</guid>
        	        	<description><![CDATA[<p>Hi, jackysee!</p>
</p>
<p>If you want to send to server id=0 instead of id=_empty, I&#39;ll recomend you use serializeEditData. As input serializeEditData receive data, which jqQuery plan to send. You can construct another data based on input data and return it. Using serializeEditData you don&#39;t modify any internal jqGrid data, so you have no side effects compares with any kind of data modification inside of onclickSubmit.</p>
</p>
<p>Best regards<br />Oleg</p>
]]></description>
        	        	<pubDate>Fri, 19 Feb 2010 12:04:02 +0200</pubDate>
        </item>
        <item>
        	<title>jackysee on Form editing add row, use '0' instead of '_empty'</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/form-editing-add-row-use-0-instead-of-_empty#p14949</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/form-editing-add-row-use-0-instead-of-_empty#p14949</guid>
        	        	<description><![CDATA[<p>I found that I can alter the value by using</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit2176' value='Select Code' data-codeid='sfcode2176' /></p>
<div class='sfcode' id='sfcode2176'>onclickSubmit: function(params){return {id:&#39;0&#39;}; }</div>
<p>Is it the proper way?</p>
]]></description>
        	        	<pubDate>Fri, 19 Feb 2010 05:11:35 +0200</pubDate>
        </item>
        <item>
        	<title>jackysee on Form editing add row, use '0' instead of '_empty'</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/form-editing-add-row-use-0-instead-of-_empty#p14948</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/form-editing-add-row-use-0-instead-of-_empty#p14948</guid>
        	        	<description><![CDATA[<p>In form editing&#39;s add row, a hidden input of "id" with value "_empty" is added.<br />Can it be changed to other value such as &#39;0&#39;? <br />Or can this hidden input be removed?</p>
]]></description>
        	        	<pubDate>Fri, 19 Feb 2010 04:55:08 +0200</pubDate>
        </item>
</channel>
</rss>