<?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: &#091;PATCH&#093; custom edit doesn't work for anything but "input" element</title>
	<link>http://www.trirand.com/blog/?page_id=393/bugs/patch-custom-edit-doesnt-work-for-anything-but-input-element</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/patch-custom-edit-doesnt-work-for-anything-but-input-element/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>tony on &#091;PATCH&#093; custom edit doesn't work for anything but "input" element</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/patch-custom-edit-doesnt-work-for-anything-but-input-element#p17797</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/patch-custom-edit-doesnt-work-for-anything-but-input-element#p17797</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>Thanks. Fixed.</p>
<p>Best Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Tue, 08 Jun 2010 15:03:22 +0300</pubDate>
        </item>
        <item>
        	<title>vchekan on &#091;PATCH&#093; custom edit doesn't work for anything but "input" element</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/patch-custom-edit-doesnt-work-for-anything-but-input-element#p17782</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/patch-custom-edit-doesnt-work-for-anything-but-input-element#p17782</guid>
        	        	<description><![CDATA[<p>I&#39;m using form&#39;s plugin custom edit feature:</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit830' value='Select Code' data-codeid='sfcode830' /></p>
<div class='sfcode' id='sfcode830'>editoptions: {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; custom_element: sitesGridCreate, <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; custom_value: sitesGridValue<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }},</div>
<p>and it does not call custom_vale function which I defined (sitesGridValue).</p>
<p>Debugging showed that problem is in grid.formedit.js:getFormData:</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit409' value='Select Code' data-codeid='sfcode409' /></p>
<div class='sfcode' id='sfcode409'>&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160; var&#160; elem = celm[0], nm = <strong><span style=&#34;color: #ff0000;&#34;>elem.name</span></strong>;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;$.each($t.p.colModel, function(i,n){<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;if(this.name == nm &#38;&#38; this.editoptions &#38;&#38;&#160;&#160;&#160;&#160; $.isFunction(this.editoptions.custom_value)) {</div>
<p>The "name" attribute is set when custom element is created:</p>
<p>grid.formedit.js grid.common.js:createEl:</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit8160' value='Select Code' data-codeid='sfcode8160' /></p>
<div class='sfcode' id='sfcode8160'>&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160; celm = jQuery(celm).addClass(&#34;customelement&#34;).attr({id:options.id,name:options.name});</div>
<p>Pay attention that "attr" was called on jQuery object, not on DOM object. But in formedit plugin&#39;s code above "name" is accessed as DOM property. It works for things like "input", which have "name" property in DOM, but if I create more complex custom element which is wrapped in "div", its DOM name property is "undefined".</p>
<p>The fix is as easy as:</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit3720' value='Select Code' data-codeid='sfcode3720' /></p>
<div class='sfcode' id='sfcode3720'>var&#160; elem = celm[0], nm = <span style=&#34;color: #ff0000;&#34;><strong>$(elem).attr(&#39;name&#39;)</strong></span>;</div>
]]></description>
        	        	<pubDate>Mon, 07 Jun 2010 21:57:55 +0300</pubDate>
        </item>
</channel>
</rss>