<?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: Question about custom element functions.</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/question-about-custom-element-functions</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/question-about-custom-element-functions/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>nelsonm on Question about custom element functions.</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/question-about-custom-element-functions#p27709</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/question-about-custom-element-functions#p27709</guid>
        	        	<description><![CDATA[<p>hi all,</p>
<p>I setup a custom element. &#160;Obviously, the custom_element function is designed to manage one custom html tag, but i used it to create three html tags that displays a credit card exp. date select block that looks like "<strong>[ MM ][</strong><strong>V</strong><strong>] / [ YY ][</strong><strong>V</strong><strong>]</strong>" in the add or edit form.</p>
<p>Here is the code:</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit8744' value='Select Code' data-codeid='sfcode8744' /></p>
<div class='sfcode' id='sfcode8744'>
<p>//jqgrid colModel segment.</p>
<p>{name:&#39;wp.ExpDate&#39;,&#8230;, edittype: &#160;&#39;custom&#39;, editoptions:{custom_element:customExpDateElement, custom_value:customExpDateValue}},</p>
</p>
<p>// jqgrid custom element(s) function.</p>
<p>function customExpDateElement(value, options){</p>
<p>&#160; &#160;var element = &#39;&#60;select date=&#34;ExpMM&#34; name=&#34;wp.ExpMM&#34; id=&#34;&#39;+ options.id + &#39;-ExpMM&#39; +&#39;&#34; class=&#34;left &#160; ui-widget-content ui-corner-all&#34; type=&#34;text&#34; title=&#34;Select Card Expiration Month&#34;&#62;&#39;+ ExpDateSelectOptions(&#39;MM&#39;) +&#39;&#60;/select&#62;&#39;+</p>
<p>&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;&#39;&#60;span id=&#34;wp-ExpDate&#34;&#62; / &#60;/span&#62;&#39;+</p>
<p>&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;&#39;&#60;select date=&#34;ExpYY&#34; name=&#34;wp.ExpYY&#34; id=&#34;&#39;+ options.id + &#39;-ExpYY&#39; +&#39;&#34; class=&#34;center ui-widget-content ui-corner-all&#34; type=&#34;text&#34; title=&#34;Select Card Expiration Year&#34; &#62;&#39;+ ExpDateSelectOptions(&#39;YY&#39;) +&#39;&#60;/select&#62;&#39;;</p>
</p>
<p>&#160; &#160;return element;</p>
<p>}</p>
</p>
<p>// jqgrid custom user value(s) function.</p>
<p>function customExpDateValue(element, operation, value){</p>
<p>&#160; &#160;var ExpMM = element[0].value;</p>
<p>&#160; &#160;var ExpYY = element[2].value;</p>
</p>
<p>&#160; &#160;return ExpMM + &#39;/&#39; + ExpYY;</p>
<p>}</p>
</div>
<p>It works great!</p>
</p>
<p>However, i have a few concerns&#8230;</p>
<p>1. With the custom element function, trying to append a string to the end of the options.id to make sure the id is unique for each select tag, it does not work. &#160;The id is always just options.id. It appears that jqgrid is simply replacing any id or name attribute i define with its own. &#160;While that is ok for a single custom element, it can be a problem when creating multiple tags within a single custom element function.</p>
</p>
<p>2. With the custom value function, how would the operation parameter be set to "set"?</p>
</p>
<p>Thanks.</p>
]]></description>
        	        	<pubDate>Sat, 10 Nov 2012 00:22:09 +0200</pubDate>
        </item>
</channel>
</rss>