<?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: dataEvents function parameter</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/dataevents-function-parameter</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/dataevents-function-parameter/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>violinssoundcool on dataEvents function parameter</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/dataevents-function-parameter#p25020</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/dataevents-function-parameter#p25020</guid>
        	        	<description><![CDATA[<p>I have a chained select box in a form edit window. I have a function that populates the second select box (scategory) based on the value of the first one (category). This function is based on <a href="http://www.ok-soft-gmbh.com/jqGrid/DependendSelects3.htm" target="_blank">this example</a>.</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit6571' value='Select Code' data-codeid='sfcode6571' /></p>
<div class='sfcode' id='sfcode6571'>function subcategory_selectbox(e){<br />&#160;&#160;&#160; var selected_category = parseInt($(e.target).val(),10);<br />&#160;&#160;&#160; var account = $(&#39;#account&#39;).val();<br />&#160;&#160;&#160; $.ajax({<br />&#160;&#160; &#160;&#160;&#160;&#160; url:&#34;SELBX_SCAT.php?cat=&#34;+selected_category+&#34;&#38;acct=&#34;+account,<br />&#160;&#160; &#160;&#160;&#160;&#160; dataType:&#34;html&#34;,<br />&#160;&#160; &#160;&#160;&#160;&#160; success:function(newOptions){<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160; var form = $(e.target).closest(&#34;form.FormGrid&#34;);<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160; $(&#34;select#scategory.FormElement&#34;,form[0]).html(newOptions);<br />&#160;&#160; &#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160; });<br />}</div>
</p>
<p>I attach it to the colModel like this:</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit1517' value='Select Code' data-codeid='sfcode1517' /></p>
<div class='sfcode' id='sfcode1517'>{name:&#39;category&#39;, editoptions:{<br />&#160;&#160;&#160; dataUrl:&#39;SELBX_CAT.php?account=&#39;+$(&#39;#account&#39;).val(),<br />&#160;&#160;&#160; dataEvents:[{<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; type:&#34;change&#34;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; fn:function(e){<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; subcategory_selectbox(e);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160; }]<br />},&#8230;</div>
</p>
<p>This works perfectly, but I can&#39;t figure out how to pass that same variable "e" from other places. For instance, I have a beforeShowForm function that I would like to be able to call subcategory_selectbox() from, but I don&#39;t know what to pass. How do I pass the same variable "e" as the dataEvents function does?</p>
</p>
<p>Also, on my account select box, I have the following function to trigger onChange:</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit906' value='Select Code' data-codeid='sfcode906' /></p>
<div class='sfcode' id='sfcode906'>$(&#39;#account&#39;).change(function(){<br />&#160;&#160;&#160; $(&#39;#transGrid&#39;).setColProp(&#39;category&#39;,{<br />&#160;&#160; &#160;&#160;&#160;&#160; editoptions:{<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160; dataUrl:&#39;SELBX_CAT.php?account=&#39;+$(&#39;#account&#39;).val()<br />&#160;&#160; &#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160; });<br />&#160;&#160;&#160; $(&#39;#transGrid&#39;).setGridParam({postData:{account:$(&#39;#account&#39;).val()}});<br />&#160;&#160;&#160; $(&#39;#transGrid&#39;).trigger(&#39;reloadGrid&#39;);<br />});</div>
</p>
<p>This does the trick as far as basing the values of the category select box on the currently selected account, but it no longer executes the dataEvents function. I even tried including the same dataEvents code from the second code snippet in this post, but it didn&#39;t work either. How can I keep the category select box based on the account select box without eliminating the dataEvents function?</p>
]]></description>
        	        	<pubDate>Fri, 28 Oct 2011 20:12:23 +0300</pubDate>
        </item>
</channel>
</rss>