<?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: Filter on empty cells</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/filter-on-empty-cells</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/filter-on-empty-cells/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>ephilippon on Filter on empty cells</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/filter-on-empty-cells#p15778</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/filter-on-empty-cells#p15778</guid>
        	        	<description><![CDATA[<p>Hi,</p>
</p>
<p>Thanks for your reply.</p>
<p>Actually, I don&#39;t have any more this problem for varchar. This is how I fixed it for varchar columns:</p>
<p>- modify the database columns&#39; default to &#39;&#39; instead of NULL (doesn&#39;t work on text type)</p>
<p style="padding-left: 30px;">alter table &#60;table&#62; alter column &#60;column&#62; set Default &#39;&#39;</p>
<p>- modify all values of all columns that contain a NULL value, and set it to the new default&#39;s one</p>
<p style="padding-left: 30px;">update &#60;table&#62; set &#60;field&#62; = &#39;&#39; where &#60;field&#62; IS NULL</p>
<p>- insert a space in the filter&#39;s entry, and press enter to get the results.</p>
</p>
<p>Now, the filter is ok for selectable values (I added a ; :Nothing in the values list), for text and for varchar values. I still can&#39;t perform this kind of search on dates (all cells that don&#39;t contain dates).</p>
</p>
<p>ps1 :&#160; I should precise that I&#39;m talking about the inline filter, not the  search box function.</p>
<p>ps2 : Yes, I perform the search on server&#39;s side</p>
<p>Here is the code that perform the search :</p>
</p>
<p>if($searchOn==&#39;true&#39;)</p>
<p>{</p>
<p>if(isset($_POST[&#39;filters&#39;])&#38;&#38;$_POST[&#39;filters&#39;]!="")</p>
<p>{</p>
<p>$sarr = json_decode(Strip($_POST[&#39;filters&#39;]), true);</p>
</p>
<p>foreach($sarr[&#39;rules&#39;] as $table)</p>
<p>{</p>
<p>$wh.=$wh==""?" WHERE ":" AND ";</p>
</p>
<p>switch($table[&#39;op&#39;])</p>
<p>{	case &#39;bn&#39;:</p>
<p>$wh .= $table[&#39;field&#39;]." NOT LIKE &#39;".$table[&#39;data&#39;]."%&#39;";</p>
<p>break;</p>
<p>case &#39;eq&#39;:</p>
<p>$wh .= $table[&#39;field&#39;]." = &#39;".$table[&#39;data&#39;]."&#39;";</p>
<p>break;</p>
<p>case &#39;bw&#39;:</p>
<p>$wh .= $table[&#39;field&#39;]." LIKE &#39;".$table[&#39;data&#39;]."%&#39;";</p>
<p>break;</p>
<p>case &#39;ne&#39;:</p>
<p>$wh .= $table[&#39;field&#39;]." &#60;&#62; &#39;".$table[&#39;data&#39;]."&#39;";</p>
<p>break;</p>
<p>case &#39;ew&#39;:</p>
<p>$wh .= $table[&#39;field&#39;]." LIKE &#39;%".$table[&#39;data&#39;]."&#39;";</p>
<p>break;</p>
<p>case &#39;en&#39;:</p>
<p>$wh .= $table[&#39;field&#39;]." NOT LIKE &#39;%".$table[&#39;data&#39;]."&#39;";</p>
<p>break;</p>
<p>case &#39;cn&#39;:</p>
<p>$wh .= $table[&#39;field&#39;]." LIKE &#39;%".$table[&#39;data&#39;]."%&#39;";</p>
<p>break;</p>
<p>case &#39;nc&#39;:</p>
<p>$wh .= $table[&#39;field&#39;]." NOT LIKE &#39;%".$table[&#39;data&#39;]."%&#39;";</p>
<p>break;</p>
<p>case &#39;lt&#39;:</p>
<p>$wh .= $table[&#39;field&#39;]." &#60; &#39;".$table[&#39;data&#39;]."&#39;";</p>
<p>break;</p>
<p>case &#39;gt&#39;:</p>
<p>$wh .= $table[&#39;field&#39;]." &#62; &#39;".$table[&#39;data&#39;]."&#39;";</p>
<p>break;</p>
<p>case &#39;le&#39;:</p>
<p>$wh .= $table[&#39;field&#39;]." &#60;= &#39;".$table[&#39;data&#39;]."&#39;";</p>
<p>break;</p>
<p>case &#39;ge&#39;:</p>
<p>$wh .= $table[&#39;field&#39;]." &#62;= &#39;".$table[&#39;data&#39;]."&#39;";</p>
<p>break;</p>
<p>case &#39;in&#39;:</p>
<p>$wh .= $table[&#39;field&#39;]." IN (".$table[&#39;data&#39;].")";</p>
<p>break;</p>
<p>case &#39;ni&#39;:</p>
<p>$wh .= $table[&#39;field&#39;]." NOT IN (".$table[&#39;data&#39;].")";</p>
<p>break;</p>
<p>default:</p>
<p>break;</p>
<p>}</p>
<p>}</p>
<p>}</p>
<p>foreach($_POST as $champ =&#62; $valeur)</p>
<p>{</p>
<p>if(in_array($champ, $liste_champs))</p>
<p>{</p>
<p>$wh.=$wh==""?" WHERE ":" AND ";</p>
<p>if(strstr($valeur,"%"))</p>
<p>{</p>
<p>$wh .= $champ." LIKE &#39;".$valeur."&#39;";</p>
<p>}</p>
<p>else</p>
<p>{</p>
<p>$wh .= $champ." = &#39;".$valeur."&#39;";</p>
<p>}</p>
<p>}</p>
<p>}</p></p>
]]></description>
        	        	<pubDate>Wed, 17 Mar 2010 17:45:29 +0200</pubDate>
        </item>
        <item>
        	<title>tony on Filter on empty cells</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/filter-on-empty-cells#p15734</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/filter-on-empty-cells#p15734</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>Do you perform the search on the server?</p>
<p>Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Mon, 15 Mar 2010 21:22:23 +0200</pubDate>
        </item>
        <item>
        	<title>ephilippon on Filter on empty cells</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/filter-on-empty-cells#p15642</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/filter-on-empty-cells#p15642</guid>
        	        	<description><![CDATA[<p>Hi,</p>
<p>I found out how to do this with columns containing values in a selected list (by introducing a value " : " in the list), but I still can&#39;t figure out how to do this for editable fields. I&#39;ve tried to do a search on all elements that contains a caracter (#column,#contain,%), and then to display all elements that don&#39;t match with this pattern, but I get all rows...</p>
</p>
<p>Do you have any idea on how to perform this kind of search? Is it a bug in my implementation of the grid, or a grid problem?</p>
<p>Thanks</p>
]]></description>
        	        	<pubDate>Fri, 12 Mar 2010 13:06:03 +0200</pubDate>
        </item>
        <item>
        	<title>ephilippon on Filter on empty cells</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/filter-on-empty-cells#p15583</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/filter-on-empty-cells#p15583</guid>
        	        	<description><![CDATA[<p>Hi all, congrats for this wonderful plugin!</p>
</p>
<p>As a new jqGrid user, I wonder if it could be possible to filter a column in order to show only rows that have an empty cell. For instance, it could be really helpful to see rows where there&#39;s a missing data.</p>
</p>
<p>Thanks a lot.</p>
</p>
<p>Eric</p>
]]></description>
        	        	<pubDate>Wed, 10 Mar 2010 18:48:37 +0200</pubDate>
        </item>
</channel>
</rss>