<?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: Dynamic Select list based on value of another cell</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/dynamic-select-list-based-on-value-of-another-cell</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/dynamic-select-list-based-on-value-of-another-cell/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>Pete on Dynamic Select list based on value of another cell</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/dynamic-select-list-based-on-value-of-another-cell#p10769</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/dynamic-select-list-based-on-value-of-another-cell#p10769</guid>
        	        	<description><![CDATA[<p>I am using inline editing in my grids, so this works when you are using inline edit.&#160; Don&#39;t know about the other editing models because I haven&#39;t used them.</p>
</p>
<p>Pete</p></p>
]]></description>
        	        	<pubDate>Fri, 16 Oct 2009 08:45:16 +0300</pubDate>
        </item>
        <item>
        	<title>jmcleod3 on Dynamic Select list based on value of another cell</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/dynamic-select-list-based-on-value-of-another-cell#p10749</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/dynamic-select-list-based-on-value-of-another-cell#p10749</guid>
        	        	<description><![CDATA[<p>Thank you for replying.<img class="spSmiley" style="margin:0" title="Laugh" src="/blog/wp-content/forum-smileys/sf-laugh.gif" alt="Laugh" /></p>
<p>I&#39;ve heard that &#39;onSelectRow&#39; is disabled when the cell is editable.<img class="spSmiley" style="margin:0" title="Yell" src="/blog/wp-content/forum-smileys/sf-yell.gif" alt="Yell" /></p>
<p>I&#39;ll look more into this though.</p>
</p>
<p>Thanks again.</p>
<p>John</p></p>
]]></description>
        	        	<pubDate>Thu, 15 Oct 2009 14:17:13 +0300</pubDate>
        </item>
        <item>
        	<title>Pete on Dynamic Select list based on value of another cell</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/dynamic-select-list-based-on-value-of-another-cell#p10748</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/dynamic-select-list-based-on-value-of-another-cell#p10748</guid>
        	        	<description><![CDATA[<p>John,</p>
</p>
<p>This may be considered more of a hack but&#160; I use this to update the values of another cell as the value in the current cell changes:</p>
<p>&#160;&#160;&#160;&#160; onSelectRow: function(id){<br />.......<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; var idID = &#39;#&#39;+id+&#39;_sector&#39;;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $(idID).bind("change", function(){<br />&#160;&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;updateSLHTML( $(idID).val(),id );<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; });<br />......<br />&#160;&#160;&#160; },</p>
</p>
<p>The updateSLHTML method looks like this:</p>
<p>// Changes the LocId inner HTML when location/sector changes<br />function updateSLHTML(Ltype,Lid){</p>
<p>var idID = &#39;#&#39;+Lid+&#39;_locId&#39;;</p>
<p>if(Ltype == &#39;L&#39;)<br />&#160;&#160;&#160; $(idID).html(colLocationsHTML);<br />else<br />&#160;&#160;&#160; $(idID).html(colSectorsHTML);</p>
<p>}</p>
</p>
<p>In this case I store preformatted HTML for the cell and just update the cell inner HTML with the new values.&#160; This *can* be done dynamically as well, you just have to convert your select data into HTML.</p>
<p>The basic concept is:&#160; Bind a change event to the cell from within the onSelectRow method and then update the inner HTML of the target cell with new content.&#160;</p>
<p>This seems to work fine, so far <img class="spSmiley" style="margin:0" title="Wink" src="/blog/wp-content/forum-smileys/sf-wink.gif" alt="Wink" /></p>
</p>
<p>Pete</p>
]]></description>
        	        	<pubDate>Thu, 15 Oct 2009 13:49:07 +0300</pubDate>
        </item>
        <item>
        	<title>jmcleod3 on Dynamic Select list based on value of another cell</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/dynamic-select-list-based-on-value-of-another-cell#p10745</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/dynamic-select-list-based-on-value-of-another-cell#p10745</guid>
        	        	<description><![CDATA[<p>I&#39;ve changed my thinking.</p>
<p>Instead of changing select options based on the value of another cell in the <span style="color: #ff0000;">next column</span>, I&#39;m changing the select options based on the value of the <span style="color: #ff0000;">current cell</span>.</p>
<p>I&#39;m still having problems trying to set the select options prior to displaying the grid.</p>
]]></description>
        	        	<pubDate>Thu, 15 Oct 2009 12:49:48 +0300</pubDate>
        </item>
        <item>
        	<title>jmcleod3 on Dynamic Select list based on value of another cell</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/dynamic-select-list-based-on-value-of-another-cell#p10739</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/dynamic-select-list-based-on-value-of-another-cell#p10739</guid>
        	        	<description><![CDATA[<p>Hello all,</p>
<p>I&#39;m fairly new to jqgrid. I&#39;ve used it in the past for a simple grid. Now the past comes back to haunt me.</p>
<p>The users want a column to contain a select dropdown.&#160; This part I can handle.&#160;</p>
<p>The problem is that the select options will change based on the value of another cell in the next column.</p>
<p>For example,</p>
<p>In one column, the select option will be "Approve" &#38; "Disapprove".</p>
<p>In the next column, the value of the cell is "Proposal in Review". This value will occasionally change to "Letter of Intent in Review or the cell will be blank".&#160;</p>
<p>I wish to dynamically change the select to "Approve Proposal", "Disapprove Proposal", "Approve LOI", "Disapprove LOI" or no select option.</p>
<p>Currently my grid is this...</p>
<p>I set the options before the grid, then call the variable when I need it.</p>
<p>var colApproveDisapprove = {value:":Click Here ;1:Approve;0:Disapprove"};</p>
<p>In the grid...</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var lastsel;<br />var colApproveDisapprove = {value:":Click Here ;1:Approve;0:Disapprove"};</p>
<p>$(document).ready(function(){ <br />&#160;&#160; &#160;jQuery("#list").jqGrid({ <br />&#160;&#160; &#160;&#160;&#160; &#160;scrollrows : true, <br />&#160;&#160; &#160;&#160;&#160; &#160;url:&#39;_getGridApplicationData.php?nd=&#39;+new Date().getTime(), <br />&#160;&#160; &#160;&#160;&#160; &#160;datatype: "json", <br />&#160;&#160; &#160;&#160;&#160; &#160;colNames:[&#39;App. ID&#39;,&#39;User ID&#39;,&#39;Created Date&#39;,&#39;Project Title&#39;,&#39;Total Amt.&#39;,&#39;Files&#39;,&#39;Actions&#39;, &#39;Status&#39;],<br />&#160;&#160; &#160;&#160;&#160; &#160;colModel:[ <br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;{name:&#39;applicationId&#39;,index:&#39;applicationId&#39;, width:75, align:"center"},<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;{name:&#39;userId&#39;,index:&#39;userId&#39;, width:75}, <br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;{name:&#39;createdDate&#39;,index:&#39;createdDate&#39;, editable:false, editoptions:{readonly:true}, width:100}, <br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;{<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;name:&#39;projectTitle&#39;,<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;index:&#39;projectTitle&#39;, <br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;width:180, <br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;align:"left",<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;formatter: &#39;showlink&#39;,<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;formatoptions:<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;{<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;target:"_new", <br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;baseLinkUrl:&#39;applicationInformationForm.php&#39;,<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;addParam:&#39;&#38;action=view&#39;,<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;idName:&#39;applicationId&#39;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;}<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;}, <br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;{<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;name:&#39;totalAmountRequested&#39;,<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;index:&#39;totalAmountRequested&#39;, <br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;width:90, <br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;align:"right",<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;editable:false,<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;editoptions:{readonly:true},<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;formatter:&#39;currency&#39;, <br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;formatoptions:<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;{<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;thousandsSeparator:","<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;}<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;}, <br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;{&#160;&#160; &#160;//Files<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;name:&#39;loiAttached&#39;, <br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;index:&#39;loiAttached&#39;, <br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;align:"center", <br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;width:100<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;},<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;{&#160;&#160; &#160;// Actions<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;name:&#39;action&#39;,<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;index:&#39;action&#39;,<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;align:"center",<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;width:150,<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;editable:true,<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;edittype:"select",<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;editoptions:colApproveDisapprove<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;},<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;{<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;name:&#39;applicationStatus&#39;,<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;index:&#39;applicationStatus&#39;, <br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;align:"center", <br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;width:140,<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;editable:false,<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;editoptions:{readonly:true}<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;}<br />&#160;&#160; &#160;&#160;&#160; &#160;],<br />&#160;&#160; &#160;&#160;&#160; &#160;cellurl:"_editAdminGrid.php",<br />&#160;&#160; &#160;&#160;&#160; &#160;cellSubmit:&#39;remote&#39;,<br />&#160;&#160; &#160;&#160;&#160; &#160;pager: jQuery(&#39;#pager&#39;), <br />&#160;&#160; &#160;&#160;&#160; &#160;rowNum:10, <br />&#160;&#160; &#160;&#160;&#160; &#160;rowList:[10,20,30], <br />&#160;&#160; &#160;&#160;&#160; &#160;imgpath:&#39;images&#39;, <br />&#160;&#160; &#160;&#160;&#160; &#160;sortname: &#39;applicationId&#39;, <br />&#160;&#160; &#160;&#160;&#160; &#160;viewrecords: true, <br />&#160;&#160; &#160;&#160;&#160; &#160;sortorder: "asc",<br />&#160;&#160; &#160;&#160;&#160; &#160;height:300,<br />&#160;&#160; &#160;&#160;&#160; &#160;cellEdit:true,<br />&#160;&#160; &#160;&#160;&#160; &#160;caption: "Grant Applications",<br />&#160;&#160; &#160;&#160;&#160; &#160;footerrow:true,<br />&#160;&#160; &#160;&#160;&#160; &#160;userDataOnFooter:true,<br />&#160;&#160; &#160;&#160;&#160; &#160;beforeEditCell:function( applicationId, applicationStatus, val, iRow, iCol ){<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;if (val == &#39;&#39;){<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;return "";<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;}else{<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;return val;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;}<br />&#160;&#160; &#160;&#160;&#160; &#160;}&#160;&#160; &#160;<br />&#160;&#160; &#160;}).navGrid(&#39;#pager&#39;,<br />&#160;&#160; &#160;{ view:false, edit:false, add:false, del:false, search:false},<br />&#160;&#160; &#160;{height:200, reloadAfterSubmit:true }, //edit options <br />&#160;&#160; &#160;{height:200, jqModal:false, closeOnEscape:true} //view options<br />&#160;&#160; &#160;)&#160;&#160; &#160;<br />});</p>
</p>
<p>The value of the "ApplicationStatus" is determined prior to JSON encoding in "_getGridApplicationData.php", then sent to the grid.</p>
<p>I&#39;m thinking about using the "beforeEditCell" event like...</p>
<p>beforeSaveCell : function(rowid,celname,value,iRow,iCol) { <br /> if( applicationStatus == &#39;LOI in review&#39; )<br /> { return &#8220;new value&#8221;; } // here&#39;s where I get lost. How do I set the options of the select? <br /> }</p>
</p>
<p>Thank you for any help.</p>
<p>JohnM</p>
]]></description>
        	        	<pubDate>Thu, 15 Oct 2009 09:41:44 +0300</pubDate>
        </item>
</channel>
</rss>