<?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: json local search bug</title>
	<link>http://www.trirand.com/blog/?page_id=393/bugs/json-local-search-bug</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/bugs/json-local-search-bug/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>brg07003 on json local search bug</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/json-local-search-bug#p22648</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/json-local-search-bug#p22648</guid>
        	        	<description><![CDATA[<p>Currently, when you load data using the addJsonData method and the datatype is &#39;json&#39; and you try local searching, all of the rows simply go away, instead of properly filtering the grid. By changing the datatype to &#39;jsonstring&#39;, the problem goes away and the local searching performs as expected (no change is needed to the incoming data).</p>
</p>
<p>Steps to Reproduce:</p>
<p>Create a grid with datatype: &#39;json&#39; and do the following:</p>
<p>1) Load data to the grid using the addJSONData method.</p>
<p>2)Perform local search. This is how I am currently doing it:</p>
<p>&#160;&#160; var grid = $(&#39;testGrid&#39;);</p>
<p>&#160;&#160; var postdata = grid.jqGrid(&#39;getGridParam&#39;, &#39;postData&#39;);</p>
<p>&#160;&#160; $.extend(postdata,</p>
<p>&#160;&#160; &#160; {</p>
<p><span style="white-space: pre;"> </span>filters: &#39;&#39;,</p>
<p><span style="white-space: pre;"> </span>searchField: &#39;colname&#39;</p>
<p><span style="white-space: pre;"> </span>searchOper: &#39;eq&#39;</p>
<p><span style="white-space: pre;"> </span>searchString: &#39;test&#39;</p>
<p>&#160;&#160; &#160; });</p>
<p>&#160;&#160; &#160; grid.jqGrid(&#39;setGridParam&#39;, {search: true, postData: postdata });</p>
<p>&#160;&#160; &#160; grid.trigger(&#39;reloadGrid&#39;, [{page: 1}]);</p>
</p>
<p>3) You will notice that the rows disappear instead of being filtered. Now change the grid&#39;s datatype to &#39;jsonstring&#39; and try again. You will notice that the rows are properly filtered.</p>
</p>
<p>I have found the bug in the grid.base.js file in version 3.8.2 at line 1167:</p>
<p><span style="white-space: pre;"> </span>locdata = (ts.p.datatype != "local" &#38;&#38; ts.p.loadonce) &#124;&#124; ts.p.datatype == "jsonstring";</p>
<p>Changing the line to the following causes it to work with datatype &#39;json&#39;</p>
<p><span style="white-space: pre;"> </span>locdata = (ts.p.datatype != "local" &#38;&#38; ts.p.loadonce) &#124;&#124; ts.p.datatype == "jsonstring" &#124;&#124; ts.p.datatype == "json";</p>
</p>
<p>jqGrid version: 3.8.2</p>
]]></description>
        	        	<pubDate>Fri, 01 Apr 2011 16:07:41 +0300</pubDate>
        </item>
</channel>
</rss>