<?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: Formedit - how to set default value of select-field?</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/formedit-how-to-set-default-value-of-select-field</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/formedit-how-to-set-default-value-of-select-field/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>gseroul on Formedit - how to set default value of select-field?</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/formedit-how-to-set-default-value-of-select-field#p18007</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/formedit-how-to-set-default-value-of-select-field#p18007</guid>
        	        	<description><![CDATA[<p>Hi,</p>
<p>I have a similar problem : I use a grid and the edit form option. The first time I edit a line in my form I have the GET request which ask the server for the select values =&#62; the 1st value is selected by default (and not the current row value). If I close the form and click again on edit =&#62; no more Get as select values are kept in memory (recreateForm false by default) and now the default value in the select is OK, and this for all rows I want to edit.</p>
<p>If I set property recreateForm to true =&#62; I have a get on the server to get select values each time =&#62; the select in the form have by default the 1st value in the list (which is wrong), even if I close and edit again.</p>
<p>My conclusion (on my code here) is that each time there is a get for select value on the server the default value is wrong (the 1st in the list). If we keep this list in memory then all other edition will have correct default value (mean the current value of the row).</p>
<p>On Safari the select have no default value =&#62; white, but closing the form and re-editing is ok.</p>
<p>On Opera I have the 1st value by default each time, even if the list is not recreated....</p>
</p>
<p>Also my select is like this :</p>
<pre><p><input type='button' class='sfcodeselect' name='sfselectit1113' value='Select Code' data-codeid='sfcode1113' /></p><div class='sfcode' id='sfcode1113'>&#60;select&#62;<br />&#60;option value=&#39;1&#39;&#62;crystalquick_rw&#60;/option&#62;<br />&#60;option value=&#39;3&#39;&#62;corning_96&#60;/option&#62;<br />&#60;option value</div><p><input type='button' class='sfcodeselect' name='sfselectit7278' value='Select Code' data-codeid='sfcode7278' /></p><div class='sfcode' id='sfcode7278'>=&#39;4&#39;&#62;corning_192&#60;/option&#62;<br />&#60;option value=&#39;6&#39;&#62;crystalquick_sw_new1&#60;/option&#62;<br />&#60;option value=&#39;7&#39;&#62;crystalquick_sw_new2</div><p><input type='button' class='sfcodeselect' name='sfselectit5618' value='Select Code' data-codeid='sfcode5618' /></p><div class='sfcode' id='sfcode5618'>&#60;/option&#62;<br />&#60;/select&#62;<br />In the row showed to users there is not the value 4 but the associated name : </div><p><input type='button' class='sfcodeselect' name='sfselectit2331' value='Select Code' data-codeid='sfcode2331' /></p><div class='sfcode' id='sfcode2331'>corning_192, <br />then jqgrid have to deal with the name to find the current value.<br />Maybe this is the cause ?</div></pre>
]]></description>
        	        	<pubDate>Thu, 17 Jun 2010 17:06:02 +0300</pubDate>
        </item>
        <item>
        	<title>gotoBirba on Formedit - how to set default value of select-field?</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/formedit-how-to-set-default-value-of-select-field#p14724</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/formedit-how-to-set-default-value-of-select-field#p14724</guid>
        	        	<description><![CDATA[<blockquote>
<p>tony said:</p>
<p>Hello,</p>
<p>The default value works for adding row. If you are in edit mode the value that is in the grid is selected in the edit form. If the value can not be found (i.e.<strong> there are differences in the grid data and the definitions in editoptions</strong>) the <span style="text-decoration: underline;">first value</span> is used. In order to do what you want in edit mode you maybe will need to use beforeShowForm event.</p>
<p>Regards</p>
<p>Tony</p>
</blockquote>
<hr />
<p>maybe i can save someone for tearing his hairs out&#8230;&#8230;. <img class="spSmiley" style="margin:0" title="Wink" src="/blog/wp-content/forum-smileys/sf-wink.gif" alt="Wink" /></p>
<p>in my case&#8230;.(in form editing: select value forgot his grid-value and showed first-select value...)&#160;it does the trick&#8230; <img class="spSmiley" style="margin:0" title="Laugh" src="/blog/wp-content/forum-smileys/sf-laugh.gif" alt="Laugh" />&#160;)</p>
<p>be carefull with MySql <strong><em>zerofilled</em></strong> fields&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;.</p>
<p>server routine that return HTMLselect <span style="text-decoration: underline;">must</span> return</p>
<p>&#8230;.</p>
<p>"&#60;option value=".<strong>intval(</strong>$row[id]<strong>)</strong>."&#62;$row[name]&#60;/option&#62;"</p>
<p>&#8230;.</p>
<p>so&#8230; we can trim leading &#39;0&#39; from value&#8230;&#8230; and it works&#8230;.</p>
<p>it take me about 2 hour of docs+forum&#8230; till i find this topic&#8230;..</p>
<p><strong><span style="text-decoration: underline;">thanks Tony..! <img class="spSmiley" style="margin:0" title="Wink" src="/blog/wp-content/forum-smileys/sf-wink.gif" alt="Wink" /><br /></span></strong></p>
]]></description>
        	        	<pubDate>Thu, 11 Feb 2010 15:59:28 +0200</pubDate>
        </item>
        <item>
        	<title>tony on Formedit - how to set default value of select-field?</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/formedit-how-to-set-default-value-of-select-field#p7514</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/formedit-how-to-set-default-value-of-select-field#p7514</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>The default value works for adding row. If you are in edit mode the value that is in the grid is selected in the edit form. If the value can not be found (i.e. there are differences in the grid data and the definitions in editoptions) the first value is used. In order to do what you want in edit mode you maybe will need to use beforeShowForm event.</p>
<p>Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Sat, 27 Jun 2009 11:55:27 +0300</pubDate>
        </item>
        <item>
        	<title>roman1983 on Formedit - how to set default value of select-field?</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/formedit-how-to-set-default-value-of-select-field#p7475</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/formedit-how-to-set-default-value-of-select-field#p7475</guid>
        	        	<description><![CDATA[<p>Hi John,</p>
<p>that is not exactly what i am looking for.</p>
<p>for example:</p>
<p><input type='button' class='sfcodeselect' name='sfselectit1044' value='Select Code' data-codeid='sfcode1044' /></p>
<div class='sfcode' id='sfcode1044'>{<br />name : &#39;status&#39;,<br />index : &#39;status&#39;,<br />width : 80,<br />editable : true,<br />edittype : "select",<br />editoptions : {<br />value:{0:&#39;Rechnung offen&#39;,1:&#39;Rechnung versendet&#39;,2:&#39;Erste Mahnung&#39;,3:&#39;Zweite Mahnung&#39;,9:&#39;Bezahlt&#39;}<br />}</div>
<p>And if have already added some items to my database. So figure out this entry:</p>
<p><span class="sfcode">name: Peter Maffay &#124; status: 3 </span></p>
</p>
<p>If i click on the row a want to edit this item, the editform opens but the status is set to "0".</p>
]]></description>
        	        	<pubDate>Fri, 26 Jun 2009 08:32:12 +0300</pubDate>
        </item>
        <item>
        	<title>jmcleod3 on Formedit - how to set default value of select-field?</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/formedit-how-to-set-default-value-of-select-field#p7473</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/formedit-how-to-set-default-value-of-select-field#p7473</guid>
        	        	<description><![CDATA[<p>To answer: How is it possible to pre-select a value in a input-field of type &#8220;select&#8221; ?</p>
<p>I&#39;ve used this in a grid I&#39;m currently working on.</p>
<p>Within the colModel, I have a row (states).</p>
<p>To set a default value for a select just use the &#39;editoptions&#39; property and the &#39;defaultValue&#39; option.</p>
<p>{name:&#39;state&#39;,index:&#39;state&#39;, width:50, <br />&#160;&#160;&#160;&#160; editable:true, <br />&#160;&#160;&#160;&#160; edittype:&#39;select&#39;,<br />&#160;&#160;&#160;&#160; editoptions:{dataUrl:&#39;states.txt&#39;, defaultValue:&#39;MI&#39;}<br />},</p>
<p>Hope this helps.</p>
<p>John</p></p>
]]></description>
        	        	<pubDate>Fri, 26 Jun 2009 07:40:29 +0300</pubDate>
        </item>
        <item>
        	<title>roman1983 on Formedit - how to set default value of select-field?</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/formedit-how-to-set-default-value-of-select-field#p7466</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/formedit-how-to-set-default-value-of-select-field#p7466</guid>
        	        	<description><![CDATA[<p>hi!</p>
</p>
<p>yes - for example my grid has a row: (1, customer 2, yes) and "yes" is a select-entry with [1:yes,0:no]</p>
<p>if i edit a entry with the value "no" it is not selected in the form.</p>
]]></description>
        	        	<pubDate>Thu, 25 Jun 2009 18:01:17 +0300</pubDate>
        </item>
        <item>
        	<title>jmcleod3 on Formedit - how to set default value of select-field?</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/formedit-how-to-set-default-value-of-select-field#p7463</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/formedit-how-to-set-default-value-of-select-field#p7463</guid>
        	        	<description><![CDATA[<p>Hi,</p>
<p>You mean like a default selection?</p>
<p>John</p>
]]></description>
        	        	<pubDate>Thu, 25 Jun 2009 16:25:09 +0300</pubDate>
        </item>
        <item>
        	<title>roman1983 on Formedit - how to set default value of select-field?</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/formedit-how-to-set-default-value-of-select-field#p7458</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/formedit-how-to-set-default-value-of-select-field#p7458</guid>
        	        	<description><![CDATA[<p>How is it possible to pre-select a value in a input-field of type "select" ?</p>
]]></description>
        	        	<pubDate>Thu, 25 Jun 2009 13:31:04 +0300</pubDate>
        </item>
</channel>
</rss>