<?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: Add colmodel option: Addable</title>
	<link>http://www.trirand.com/blog/?page_id=393/feature-request/add-colmodel-option-addable</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/feature-request/add-colmodel-option-addable/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>brecht on Add colmodel option: Addable</title>
        	<link>http://www.trirand.com/blog/?page_id=393/feature-request/add-colmodel-option-addable#p25182</link>
        	<category>Feature Request</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/feature-request/add-colmodel-option-addable#p25182</guid>
        	        	<description><![CDATA[<p>Didn&#39;t like the implementation.</p>
<p>This is better:</p>
<p><input type='button' class='sfcodeselect' name='sfselectit3025' value='Select Code' data-codeid='sfcode3025' /></p>
<div class='sfcode' id='sfcode3025'>recreateForm:&#160;true,<br />beforeInitData:&#160;function&#160;(formid)&#160;{&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //&#160;Add&#160;fields&#160;which&#160;are&#160;addable&#160;but&#160;not&#160;editable.&#160;jQgrid&#160;doesn&#39;t&#160;know&#160;a&#160;property&#160;&#39;Addable&#39;.<br />&#160;&#160;&#160;&#160;&#160; colModelIterator(function(col)&#160;{<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if&#160;(col.addable)&#160;{<br />&#160; &#160; &#160; &#160;&#160;&#160;&#160;&#160;&#160; grid.setColProp(col.name,&#160;{&#160;editable:&#160;true&#160;});<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160;&#160;&#160; });<br />},<br />afterComplete:&#160;function&#160;(response,&#160;postdata,&#160;formid)&#160;{<br />//&#160;Remove&#160;editable&#160;option.<br />&#160;&#160; colModelIterator(function&#160;(col)&#160;{<br />&#160;&#160;&#160;&#160;&#160;&#160; if&#160;(col.addable)&#160;{<br />&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160; grid.setColProp(col.name,&#160;{&#160;editable:&#160;false&#160;});<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160; });<br />}</p>
<p> function colModelIterator(callback) {<br />&#160;&#160;&#160; var colModel = grid.jqGrid(&#39;getGridParam&#39;, &#39;colModel&#39;);<br />&#160;&#160;&#160; for (var index in colModel) {             callback(colModel[index]);         }     <br />}</p>
</div>
]]></description>
        	        	<pubDate>Thu, 17 Nov 2011 14:20:39 +0200</pubDate>
        </item>
        <item>
        	<title>brecht on Add colmodel option: Addable</title>
        	<link>http://www.trirand.com/blog/?page_id=393/feature-request/add-colmodel-option-addable#p25164</link>
        	<category>Feature Request</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/feature-request/add-colmodel-option-addable#p25164</guid>
        	        	<description><![CDATA[<p>Hi</p>
<p>I&#39;de like to have an option &#39;Addable&#39; or &#39;Insertable&#39; on the colModel.<br />Why? Imagine this scenario:</p>
<p>I want a grid on a table with all crud operations. My table can have multiple columns which I don&#39;t want to be edited, like eg: primary key(s), incremental id, .. . However, I want some of those uneditable columns to be insertable in the add form.</p>
<p>I tackled this by following workaround in the navgrid add dialog properties:</p>
<p><input type='button' class='sfcodeselect' name='sfselectit684' value='Select Code' data-codeid='sfcode684' /></p>
<div class='sfcode' id='sfcode684'>&#160;&#160;recreateForm:&#160;true, &#160; beforeShowForm:&#160;function&#160;(formid)&#160;{ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;// Add fields which are addable but not editable. jQgrid doesn&#39;t know a property &#39;Addable&#39;.<br />&#160;&#160; &#160;var extraAddable = jQuery(&#34;#GenericTableManager&#34;).jqGrid(&#39;getGridParam&#39;, &#39;colModel&#39;);</p>
<p>&#160;&#160; &#160;for (var i = extraAddable.length -1; i &#62; 0 ; i--) {<br />&#160;&#160; &#160;&#160;&#160; &#160;if (extraAddable[i].addable) {<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;$(&#39;&#60;tr id=&#34;tr_&#39; + extraAddable[i].name + &#39;&#34; class=&#34;FormData&#34;&#62;&#39; +<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#39;&#60;td class=&#34;CaptionTD&#34;&#62;&#39; + extraAddable[i].name + &#39;&#60;/td&#62;&#39; +<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#39;&#60;td class=&#34;DataTD&#34;&#62;&#39; +<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#39;&#60;input id=&#34;&#39; + extraAddable[i].name + &#39;&#34; class=&#34;FormElement ui-widget-content ui-corner-all&#34; type=&#34;text&#34; name=&#34;&#39;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;+ extraAddable[i].name + &#39;&#34; role=&#34;textbox&#34;&#62;&#39; +<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#39;&#60;/td&#62;&#39; +<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160; &#39;&#60;/tr&#62;&#39;)<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;.insertAfter($(&#39;.tinfo&#39;));<br />&#160;&#160; &#160;&#160;&#160; &#160;}<br />&#160;&#160; &#160;}<br />}</p>
</div>
<p>Works just fine, but would be nice if this was a default option.</p>
</p>
<pre>Sorry about the edits: pasting code is one hardcore business.</pre></p>
]]></description>
        	        	<pubDate>Tue, 15 Nov 2011 15:42:50 +0200</pubDate>
        </item>
</channel>
</rss>