<?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: Building postdata</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/building-postdata</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/building-postdata/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>kxlin on Building postdata</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/building-postdata#p19993</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/building-postdata#p19993</guid>
        	        	<description><![CDATA[<p>I figured out by myself:</p>
</p>
<p>&#160;&#160;&#160; beforeRequest: function() {<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;var inputlabel1 = &#39; where 1=1 &#39;;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;var postData = $("#project").jqGrid(&#39;getGridParam&#39;,&#39;postData&#39;) ;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;var colModel = $("#project").jqGrid(&#39;getGridParam&#39;,&#39;colModel&#39;) ;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;$.each(postData,function(the_key,the_value) {<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;$.each(colModel, function(idx,the_item){<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;if (the_item.index==the_key) inputlabel1 += &#39; and &#39;+ the_key + " like &#39;%"+the_value+"%&#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;if (postData.sidx) inputlabel1 += &#39; order by &#39;+ postData.sidx + &#39; &#39; + postData.sord<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;//alert(inputlabel1);<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;postData.inputlabel1=inputlabel1;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;$("#project").jqGrid(&#39;setGridParam&#39;,{&#39;postData&#39;:postData});&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;<br />&#160;&#160; &#160;},</p>
]]></description>
        	        	<pubDate>Sat, 25 Sep 2010 06:01:37 +0300</pubDate>
        </item>
        <item>
        	<title>kxlin on Building postdata</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/building-postdata#p19987</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/building-postdata#p19987</guid>
        	        	<description><![CDATA[<p>The reason why I need to do this is because I&#39;m not using PHP/ASP and have little control over server side script.</p>
]]></description>
        	        	<pubDate>Fri, 24 Sep 2010 20:55:18 +0300</pubDate>
        </item>
        <item>
        	<title>kxlin on Building postdata</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/building-postdata#p19986</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/building-postdata#p19986</guid>
        	        	<description><![CDATA[<p>I&#39;m new to jqGrid, so bear with me if this is obvious in the manual... 🙂</p>
<p>I have the jqGrid defined as:</p>
<p>jQuery("#project").jqGrid({<br />&#160;&#160; &#160;url: &#39;myurl&#39;,<br />&#160;&#160; &#160;postData: {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; whereclause: ""<br />&#160;&#160; &#160;},&#160;&#160; &#160;<br />&#160;&#160; &#160;datatype: &#39;json&#39;,<br />......</p>
<p>By default,&#160; when requesting new data jqGrid is appending myurl like this:</p>
<p>myurl?page=1&#38;rows=10&#38;mysort=myindex&#38;sord=asc&#38;colname=&#39;abc&#39;</p>
<p>Instead, I want to build the whereclause in postdata on the fly:</p>
<p>myurl?page=1&#38;rows=10&#38;whereclause="where colname=&#39;abc&#39; order by myindex asc"</p>
<p>Basically I have a SQL built into myurl: "select * from mytable %1", and the whereclause will be replacing the %1.</p>
<p>Any idea how I should proceed? Thanks in advance.</p>
]]></description>
        	        	<pubDate>Fri, 24 Sep 2010 20:52:33 +0300</pubDate>
        </item>
</channel>
</rss>