<?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: multi-checkbox custom edittype solution</title>
	<link>http://www.trirand.com/blog/?page_id=393/treegrid/multi-checkbox-custom-edittype-solution</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/treegrid/multi-checkbox-custom-edittype-solution/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>feasfeasf on multi-checkbox custom edittype solution</title>
        	<link>http://www.trirand.com/blog/?page_id=393/treegrid/multi-checkbox-custom-edittype-solution#p21749</link>
        	<category>TreeGrid</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/treegrid/multi-checkbox-custom-edittype-solution#p21749</guid>
        	        	<description><![CDATA[<p>note that there is a error &#39;Uncaught SyntaxError: Unexpected token &#38;&#39; on following line:</p>
</p>
<p>ctl = ctl.replace( /&#60;br /&#62;&#38;nbsp;$/, &#39;&#39; );</p>
</p>
<p>it could be fixed by :</p>
</p>
<p>ctl = ctl.replace( /&#60;br \\/&#62;&#38;nbsp;$/, &#39;&#39; );</p>
]]></description>
        	        	<pubDate>Wed, 19 Jan 2011 11:05:06 +0200</pubDate>
        </item>
        <item>
        	<title>downunder on multi-checkbox custom edittype solution</title>
        	<link>http://www.trirand.com/blog/?page_id=393/treegrid/multi-checkbox-custom-edittype-solution#p20055</link>
        	<category>TreeGrid</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/treegrid/multi-checkbox-custom-edittype-solution#p20055</guid>
        	        	<description><![CDATA[<p>Nice work, but how do you bring the values to the checkboxes when you do an edit?</p>
</p>
<p>let&#39;s say I have 3 checkboxes:</p>
<p>test1 checked</p>
<p>test &#160;not_checked</p>
<p>test3 checked</p>
<p>the value are saved in the database. Next time I want to edit the records the "test1" and "text3" should be already checked when openening the form. I tried to modifiy your script but couldn&#39;t find out how to bring the values from the json dataset to your function...</p>
]]></description>
        	        	<pubDate>Tue, 28 Sep 2010 17:50:23 +0300</pubDate>
        </item>
        <item>
        	<title>Gil on multi-checkbox custom edittype solution</title>
        	<link>http://www.trirand.com/blog/?page_id=393/treegrid/multi-checkbox-custom-edittype-solution#p17137</link>
        	<category>TreeGrid</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/treegrid/multi-checkbox-custom-edittype-solution#p17137</guid>
        	        	<description><![CDATA[<p>I created a muti-checkbox form element, and thought I&#39;d share. This was built using version 3.6.4. If anyone has a more efficient solution, please pass it on.</p>
</p>
<p>Within the colModel, the appropriate edit fields look like this:</p>
<p style="padding-left: 30px;">edittype:&#39;custom&#39;</p>
<p style="padding-left: 30px;">editoptions:{ custom_element:MultiCheckElem,  custom_value:MultiCheckVal, list:&#39;Check1,Check2,Check3,Check4&#39; }</p>
<p style="padding-left: 30px;">&#160;</p>
<p>Here are the javascript functions (BTW, It also works - with some modifications - when the list of checkboxes is in a DIV block):</p>
<p style="padding-left: 30px;">//------------------------------------------------------------<br />// Description:<br />//&#160;&#160; MultiCheckElem is the "custom_element" function that builds the custom multiple check box input<br />//&#160;&#160; element. From what I have gathered, jqGrid calls this the first time the form is launched. After<br />//&#160;&#160; that, only the "custom_value" function is called.<br />//<br />//&#160;&#160; The full list of checkboxes is in the jqGrid "editoptions" section "list" tag (in the options<br />//&#160;&#160; parameter).<br />//------------------------------------------------------------<br />function MultiCheckElem( value, options )<br />{<br />&#160;&#160; //----------<br />&#160;&#160; // for each checkbox in the list<br />&#160;&#160; //&#160;&#160; build the input element<br />&#160;&#160; //&#160;&#160; set the initial "checked" status <br />&#160;&#160; // endfor<br />&#160;&#160; //----------<br />&#160;&#160; var ctl = &#39;&#39;;<br />&#160;&#160; var ckboxAry = options.list.split(&#39;,&#39;);</p>
<p>&#160;&#160; for ( var i in ckboxAry )<br />&#160;&#160; {<br />&#160;&#160;&#160;&#160;&#160; var item = ckboxAry[i];<br />&#160;&#160;&#160;&#160;&#160; ctl += &#39;&#60;input type="checkbox" &#39;;</p>
<p>&#160;&#160;&#160;&#160;&#160; if ( value.indexOf(item + &#39;&#124;&#39;) != -1 )<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ctl += &#39;checked="checked" &#39;;<br />&#160;&#160;&#160;&#160;&#160; ctl += &#39;value="&#39; + item + &#39;"&#62; &#39; + item + &#39;&#60;/input&#62;&#60;br /&#62;&#38;nbsp;&#39;;<br />&#160;&#160; }</p>
<p>&#160;&#160; ctl = ctl.replace( /\&#60;br \/\&#62;\&#38;nbsp;$/, &#39;&#39; );<br />&#160;&#160; return ctl;<br />}</p>
<p style="padding-left: 30px;">&#160;</p>
<p style="padding-left: 30px;">//------------------------------------------------------------<br />// Description:<br />//&#160;&#160; MultiCheckVal is the "custom_value" function for the custom multiple check box input element. It<br />//&#160;&#160; appears that jqGrid invokes this function the first time the form is submitted and, the rest of<br />//&#160;&#160; the time, when the form is launched (action = set) and when it is submitted (action = &#39;get&#39;).<br />//------------------------------------------------------------<br />function MultiCheckVal(elem, action, val)<br />{<br />&#160;&#160; var items = &#39;&#39;;<br />&#160;&#160; if (action == &#39;get&#39;) // the form has been submitted<br />&#160;&#160; {<br />&#160;&#160;&#160;&#160;&#160; //----------<br />&#160;&#160;&#160;&#160;&#160; // for each input element<br />&#160;&#160;&#160;&#160;&#160; //&#160;&#160; if it&#39;s checked, add it to the list of items<br />&#160;&#160;&#160;&#160;&#160; // endfor<br />&#160;&#160;&#160;&#160;&#160; //----------<br />&#160;&#160;&#160;&#160;&#160; for (var i in elem)<br />&#160;&#160;&#160;&#160;&#160; {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (elem[i].tagName == &#39;INPUT&#39; &#38;&#38; elem[i].checked )<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; items += elem[i].value + &#39;,&#39;;<br />&#160;&#160;&#160;&#160;&#160; }</p>
<p>&#160;&#160;&#160;&#160;&#160; // items contains a comma delimited list that is returned as the result of the element<br />&#160;&#160;&#160;&#160;&#160; items = items.replace(/\,$/, &#39;&#39;);<br />&#160;&#160; }<br />&#160;&#160; else // the form is launched<br />&#160;&#160; {<br />&#160;&#160;&#160;&#160;&#160; //----------<br />&#160;&#160;&#160;&#160;&#160; // for each input element<br />&#160;&#160;&#160;&#160;&#160; //&#160;&#160; based on the input value, set the checked status<br />&#160;&#160;&#160;&#160;&#160; // endfor<br />&#160;&#160;&#160;&#160;&#160; //----------<br />&#160;&#160;&#160;&#160;&#160; for (var i in elem)<br />&#160;&#160;&#160;&#160;&#160; {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (elem[i].tagName == &#39;INPUT&#39;)<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (val.indexOf(elem[i].value + &#39;&#124;&#39;) == -1)<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; elem[i].checked = false;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; else<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; elem[i].checked = true;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160;&#160;&#160; } // endfor<br />&#160;&#160; }</p>
<p>&#160;&#160; return items;<br />}</p></p>
]]></description>
        	        	<pubDate>Thu, 13 May 2010 10:00:31 +0300</pubDate>
        </item>
</channel>
</rss>