<?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: Timing of gridComplete event with Trirand's jqGrid</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/timing-of-gridcomplete-event-with-trirands-jqgrid</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/timing-of-gridcomplete-event-with-trirands-jqgrid/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>Octavient on Timing of gridComplete event with Trirand's jqGrid</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/timing-of-gridcomplete-event-with-trirands-jqgrid#p24840</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/timing-of-gridcomplete-event-with-trirands-jqgrid#p24840</guid>
        	        	<description><![CDATA[<p>I&#39;m not convinced that the gridComplete event runs "after all the data is loaded into the grid and all other processes are complete," as specified in the&#160;<a rel="nofollow" href="/jqgridwiki/doku.php?id=wiki%3aevents" target="_blank">documentation</a>.</p>
<p>I&#39;ve got a grid that is loading correctly. In the gidComplete event, I&#39;m triggering some filtering methods (.extend and .setGridParam) to apply a filter as soon as the grid is loaded. However, although my custom function is firing (seen through console), the filter is not being applied. If I use the setTimeout to delay the execution by a second (or so), then the filter is, in fact, applied. So it seems to me that the gridComplete is firing too early.</p>
<p>Incidentally, the filter function (called setGridFilter()) also fires in an onchange event bound to a select menu (where the user can choose from pre-set filter options). This works perfectly. It&#39;s just the gridComplete invocation of this function that is failing.</p>
<p>Any ideas?</p>
</p>
<pre class="default prettyprint"><p><input type='button' class='sfcodeselect' name='sfselectit5610' value='Select Code' data-codeid='sfcode5610' /></p><div class='sfcode' id='sfcode5610'>$(&#34;#list3&#34;).jqGrid({<br />&#160; &#160;url: &#39;blah.php&#39;,<br />&#160; &#160;colNames: [&#39;blah1&#39;,&#39;blah2&#39;,&#39;etc.&#39;,&#39;PresentationTemplateID&#39;],<br />&#160; &#160;colModel: [name: &#39;blah1&#39;, index: &#39;blah1&#39;],<br />&#160; &#160; &#160; &#160;[name: &#39;blah2&#39;, index: &#39;blah2&#39;],<br />&#160; &#160; &#160; &#160;[name: &#39;etc.&#39;, index: &#39;etc.&#39;],<br />&#160; &#160; &#160; &#160;[name: &#39;PresentationTemplateID&#39;, index: &#39;PresentationTemplateID&#39;, hidden:true]<br />&#160; &#160;viewRecords:true,<br />&#160; &#160;loadonce: true,<br />&#160; &#160;pager: &#39;#pager3&#39;,<br />&#160; &#160;search:true,<br />&#160; &#160;gridComplete: function(){<br />&#160; &#160; &#160; &#160;//var t = setTimeout(&#39;setGridFilter()&#39;,1000); &#160; //this works, for some reason<br />&#160; &#160; &#160; &#160;setGridFilter(); &#160;//this does not<br />&#160; &#160;}<br />});<br /><br />function setGridFilter() {<br />&#160; &#160;var postdata = $(&#34;#list3&#34;).jqGrid(&#39;getGridParam&#39;,&#39;postData&#39;);<br />&#160; &#160;var text = $(&#34;#ddlGridFilterMenu&#34;).val(), f;<br />&#160; &#160;$.extend(postdata,{filters:&#39;&#39;,searchField: &#39;PresentationTemplateID&#39;, searchOper: &#39;eq&#39;, searchString: text});<br />&#160; &#160;$(&#34;#list3&#34;).jqGrid(&#39;setGridParam&#39;, { search: text.length&#62;0, postData: postdata });<br />&#160; &#160;$(&#34;#list3&#34;).trigger(&#34;reloadGrid&#34;,[{page:1}]);<br />}</div></pre>
]]></description>
        	        	<pubDate>Fri, 07 Oct 2011 18:57:52 +0300</pubDate>
        </item>
</channel>
</rss>