<?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: Can't get a second request in place</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/cant-get-a-second-request-in-place</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/cant-get-a-second-request-in-place/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>mchojrin on Can't get a second request in place</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/cant-get-a-second-request-in-place#p15817</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/cant-get-a-second-request-in-place#p15817</guid>
        	        	<description><![CDATA[<p>I found a somewhat elegant solution to my problem. I believe the issue was in using the GridUnload method and re constructing the whole grid, which in my case, didn&#39;t make much sense to begin with. So I had to make a difference in whether the grid was already constructed or not (which was actually the hardest step). I used this test in order to see wether the grid was constructed or not:</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit9770' value='Select Code' data-codeid='sfcode9770' /></p>
<div class='sfcode' id='sfcode9770'>var g = $(&#34;#searchResults&#34;);<br />&#160;&#160; &#160;<br />&#160;&#160;&#160; if ( typeof(g[0].grid ) == &#34;undefined&#34; )</div>
<p>I don&#39;t know if there&#39;s a better way to accomplish this, if not, I think it&#39;d be a good addition to the jqGrid plugin. Anyway, what I did in the else part of this if is change the postData and then reload the grid (but without unloading it first):</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit4908' value='Select Code' data-codeid='sfcode4908' /></p>
<div class='sfcode' id='sfcode4908'>else<br />&#160;&#160;&#160; {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; g.setGridParam( {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; postData: {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; name: searchFor&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; } <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; } );<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; g.trigger(&#34;reloadGrid&#34;);<br />&#160;&#160;&#160; }</div>
<p>And that was it!<img class="spSmiley" style="margin:0" title="Smile" src="/blog/wp-content/forum-smileys/sf-smile.gif" alt="Smile" />. Perhaps another good addition could be a method to reload the grid with new post parameters or to add some parameters to the trigger("reloadGrid") method...</p>
</p>
<p>&#160; Anyway, thanks to all and hope this helps somebody!</p>
]]></description>
        	        	<pubDate>Thu, 18 Mar 2010 15:50:40 +0200</pubDate>
        </item>
        <item>
        	<title>mchojrin on Can't get a second request in place</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/cant-get-a-second-request-in-place#p15761</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/cant-get-a-second-request-in-place#p15761</guid>
        	        	<description><![CDATA[<p>Hi:</p>
<p>&#160; I&#39;m having an awkward problem here. I need to have a jqGrid return the results of a search query. What I need to do is, if the results are not what the user expected, they can specify a new search criteria and re run the query.</p>
</p>
<p>&#160; The problem is that for the second search to actually show up in the grid, I need an extra mouse click, I mean, the first search creates the grid and fills it fine. The second click would destroy (actually UnLoad) the grid but won&#39;t re-populate it and only the third click will show the results of the second search.</p>
</p>
<p>&#160; Here&#39;s my code:</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit5291' value='Select Code' data-codeid='sfcode5291' /></p>
<div class='sfcode' id='sfcode5291'>$(&#34;#searchButton&#34;).click(function(){<br />&#160;&#160;&#160; var searchFor = $(&#34;#searchField&#34;).val();<br />&#160;&#160;&#160; var searchType = $(&#39;input[name=&#34;search_type&#34;]:checked&#39;).val();</p>
<p>&#160;&#160;&#160; var g = $(&#34;#searchResults&#34;);<br />&#160;&#160;&#160; if ( g.jqGrid() )<br />&#160;&#160;&#160; g.GridUnload();<br />&#160;&#160;&#160; var project_id = $(&#34;#searchDialog #targetProject&#34;).val();<br />&#160;&#160; &#160;<br />&#160;&#160;&#160; g.jqGrid(<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; datatype: &#34;json&#34;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; height: &#39;auto&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; autowidth: true,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; url: &#39;&#60;?php echo url_for2(&#39;ajaxProjectSearch&#39;)?&#62;&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; postData: {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; name: searchFor,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; searchType: searchType<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; },<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; mtype: &#34;POST&#34;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; colModel:[<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; { name:&#39;project_number&#39;, sortable: false, label: &#39;PSM&#39;, width: 20 },<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; { name:&#39;project_name&#39;, sortable:false, label: &#39;Project name&#39;, width: 70 }<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ],<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; viewrecords: true,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; imgpath: gridimgpath,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; rowNum: 10,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; multiselect: false,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; caption: &#34;Search Results&#34;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; rowList:[10,20,30],<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; pager: &#39;searchResults_pager&#39;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160; );<br />});</p>
</div>
<p>Thanks!</p>
]]></description>
        	        	<pubDate>Tue, 16 Mar 2010 19:23:12 +0200</pubDate>
        </item>
</channel>
</rss>