<?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: filtertoolbar defaultValue</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/filtertoolbar-defaultvalue</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/filtertoolbar-defaultvalue/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>daanl on filtertoolbar defaultValue</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/filtertoolbar-defaultvalue#p16815</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/filtertoolbar-defaultvalue#p16815</guid>
        	        	<description><![CDATA[</p>
<p>Found the solution, using the beforeRequest, im appending the extra criterium this way the first request takes also</p>
<p>the filter data:</p>
<p>config.beforeRequest = function()</p>
<p>{<br />&#160;&#160; &#160;if (!$(this).getPostDataItem(&#39;filters&#39;))<br />&#160;&#160; &#160;{<br />&#160;&#160; &#160;&#160;&#160; &#160;$(this).appendPostData({"filters":"{"groupOp":"AND","rules":[{"field":"test","op":"bw","data":"asdf"}"});<br />&#160;&#160; &#160;}<br />};</p>
</p>
<p>Im also using an cookie to set the data when filtering and echoing the cookie (im using php)</p>
<p>with appendPostData(&#60;?php echo $_COOKIE[&#39;filterthing&#39;] ?&#62;) so it will result to:</p>
<p>{"filters":"{"groupOp":"AND","rules":[{"field":"test","op":"bw","data":"asdf"}"}</p>
</p>
<p>$(&#39;#testinggrid&#39;).filterToolbar({<br />&#160;&#160; &#160;&#160;&#160; &#160;autosearch: true,<br />&#160;&#160; &#160;&#160;&#160; &#160;searchOnEnter: false,<br />&#160;&#160; &#160;&#160;&#160; &#160;stringResult:true,<br />&#160;&#160; &#160;&#160;&#160; &#160;beforeSearch: function()<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;{<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;$.cookie(&#39;filterthing&#39;, JSON.stringify($(&#39;#testinggrid&#39;).getGridParam(&#39;postData&#39;)));<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;}<br />&#160;&#160; &#160;});</p>
</p>
<p>You will need the jquery cookie plugin to use this way with the cookie or get some other javascript cookie thing</p>
<p>if you want to remeber the user input in the filter columns, if not the onbeforeRequest thing is the only thing you&#39;ll</p>
<p>need.</p>
<p>getGridParam will return an object so you need to set it to a string or set an object cookie.</p></p>
]]></description>
        	        	<pubDate>Fri, 30 Apr 2010 12:42:31 +0300</pubDate>
        </item>
        <item>
        	<title>daanl on filtertoolbar defaultValue</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/filtertoolbar-defaultvalue#p16806</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/filtertoolbar-defaultvalue#p16806</guid>
        	        	<description><![CDATA[<p>Hello,</p>
</p>
<p>Im having some weird issue, i have put the this in the colmodel {name: &#39;test&#39;, index: &#39;test&#39;, search : &#39;true&#39;, stype: &#39;text&#39;, searchoptions: { defaultValue: &#39;asdfasf&#39;}}</p>
<pre id="line112"><br />when the grid loads the data (ajax call) it doesn&#39;t uses the defaultValue and the field for the filters<br /><br />var config = {<br />"url:"http://theurl",<br />"datatype":"json",<br />"colNames":["test"],<br />"colModel":[ {"name":"test","index":"test","search":true,"stype":"text","searchoptions":{"defaultValue":"asdfasdf"}} ],<br />"rowNum":10,<br />"rowList":[10,20,30],<br />"pager":"pager",<br />"sortname":"test",<br />"viewrecords":true,<br />"sortorder":"asc",<br />"height":"100%",<br />"autowidth":true,<br />"viewsortcols":[false,"horizontal",true],<br />"filterable":true,<br />"imgpath":"js",<br />"search":true,<br />"jsonReader":{"repeatitems":false,"id":"0"}<br />};<br /><br />$(&#39;#testingrid&#39;).jqGrid(config);<br />$(&#39;#testingrid&#39;).filterToolbar({<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;autosearch: true,<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;searchOnEnter: false,<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;stringResult:true,&#160;&#160; &#160;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;});<br /><br />The url will give this: <a onclick="javascript:pageTracker._trackPageview(&#39;/outbound/article/http://theurl?something&#38;_search=true&#38;nd=1272564042200&#38;rows=10&#38;page=1&#38;sidx=test&#38;sord=asc&#39;);" rel="nofollow" href="http://theurl?something&#38;_search=true&#38;nd=1272564042200&#38;rows=10&#38;page=1&#38;sidx=test&#38;sord=asc" target="_blank">http://theurl?something&#38;_s.....p;sord=asc</a><br /><br />instead of:<br /><br /><a onclick="javascript:pageTracker._trackPageview(&#39;/outbound/article/http://theurl?something&#38;_search=true&#38;nd=1272565305480&#38;rows=10&#38;page=1&#38;sidx=test&#38;sord=asc&#38;filters=%7B%22groupOp%22%3A%22AND%22%2C%22rules%22%3A%5B%7B%22field%22%3A%22test%22%2C%22op%22%3A%22bw%22%2C%22data%22%3A%22asdfasdf%22%7D%2C%7B%22&#39;);" rel="nofollow" href="http://theurl?something&#38;_search=true&#38;nd=1272565305480&#38;rows=10&#38;page=1&#38;sidx=test&#38;sord=asc&#38;filters=%7B%22groupOp%22%3A%22AND%22%2C%22rules%22%3A%5B%7B%22field%22%3A%22test%22%2C%22op%22%3A%22bw%22%2C%22data%22%3A%22asdfasdf%22%7D%2C%7B%22" target="_blank">http://theurl?something&#38;_s.....D%2C%7B%22</a><br /><br />Does someone know how to use the default value in the filters when the grid loads for the first time.<br /><br />Thanks!<br /><br />Greets </pre>
]]></description>
        	        	<pubDate>Thu, 29 Apr 2010 21:24:39 +0300</pubDate>
        </item>
</channel>
</rss>