<?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: single search not working</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/single-search-not-working</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/single-search-not-working/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>romaneduardo on single search not working</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/single-search-not-working#p17763</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/single-search-not-working#p17763</guid>
        	        	<description><![CDATA[<p>Hi Tim.</p>
<div dir="ltr">Thanks for your response.</div>
</p>
<p>It was  certainly a problem in PHP to SQL.</p>
</p>
<p>I mistakenly  thought Jqgrid did everything. And of  course, PHP and MYSQL code must be written by each user.&#160;<span style="color: #993366;"><strong>Mainly  MYSQL</strong></span> code for search functions.</p>
</p>
<p>The  search module works for me as it is, but it was a difficult task to  achieve.</p>
</p>
<p>For  anyone who has the same doubt, the lesson learned is that: the code to  execute searches with Jqgrid must be written yourself. The demos are just that, demos!</p>
</p>
<p>Thanks again Tim.</p>
]]></description>
        	        	<pubDate>Sat, 05 Jun 2010 02:32:15 +0300</pubDate>
        </item>
        <item>
        	<title>tim on single search not working</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/single-search-not-working#p17567</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/single-search-not-working#p17567</guid>
        	        	<description><![CDATA[<p>This is a PHP to SQL issue, not a jqGrid issue.</p>
<p>From what I can see, not understanding anything about PHP, your</p>
<p>case &#39;invid&#39;:</p>
<p>is not being applied to the varialbe $wh</p>
<p>To troubleshoot this put your debugger on and look at the output for $wh inside your</p>
<p>switch ($examp) {<br />&#160;&#160;&#160; case 1:</p>
<p>statement.</p>
<p>or just look at the actual SQL being sent to the database.</p>
<p>tim</p></p>
]]></description>
        	        	<pubDate>Sun, 30 May 2010 01:58:56 +0300</pubDate>
        </item>
        <item>
        	<title>romaneduardo on single search not working</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/single-search-not-working#p17566</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/single-search-not-working#p17566</guid>
        	        	<description><![CDATA[<p>( apologize, and publish this post but do  not see )</p>
<div dir="ltr"></div>
<div dir="ltr"></div>
<div dir="ltr">I do not understand why it does not work.</div>
<div dir="ltr"></div>
<div dir="ltr"><a href="http://s3.subirimagenes.com:81/otros/previo/thump_4581551grid1.jpg"><img src="http://s3.subirimagenes.com:81/otros/previo/thump_4581551grid1.jpg" width="100"  class="sfimageleft spUserImage" alt="" /><img src="http://www.trirand.com/blog/wp-content/sp-resources/forum-themes/default/images/sp_Mouse.png" class="sfimageleft sfmouseleft" alt="Image Enlarger" /></a></div>
<div dir="ltr"></div>
<div dir="ltr">execute search</div>
<div dir="ltr"></div>
<div dir="ltr"><a href="http://s2.subirimagenes.com/otros/previo/thump_4581649bbus.jpg"><img src="http://s2.subirimagenes.com/otros/previo/thump_4581649bbus.jpg" width="100"  class="sfimageleft spUserImage" alt="jb" /><img src="http://www.trirand.com/blog/wp-content/sp-resources/forum-themes/default/images/sp_Mouse.png" class="sfimageleft sfmouseleft" alt="Image Enlarger" /></a></div>
<div dir="ltr"></div>
<div dir="ltr">I hope, one row with result INV NO 654</div>
<div dir="ltr"></div>
<div dir="ltr"><a href="http://s3.subirimagenes.com:81/otros/previo/thump_4581639g2.jpg"><img src="http://s3.subirimagenes.com:81/otros/previo/thump_4581639g2.jpg" width="100"  class="sfimageleft spUserImage" alt="eb" /><img src="http://www.trirand.com/blog/wp-content/sp-resources/forum-themes/default/images/sp_Mouse.png" class="sfimageleft sfmouseleft" alt="Image Enlarger" /></a></div>
<div dir="ltr"></div>
<div dir="ltr">but result same</div>
<div dir="ltr"></div>
<div dir="ltr"></div>
<div dir="ltr"><a href="http://s3.subirimagenes.com:81/otros/previo/thump_4581551grid1.jpg"><img src="http://s3.subirimagenes.com:81/otros/previo/thump_4581551grid1.jpg" width="100"  class="sfimageleft spUserImage" alt="" /><img src="http://www.trirand.com/blog/wp-content/sp-resources/forum-themes/default/images/sp_Mouse.png" class="sfimageleft sfmouseleft" alt="Image Enlarger" /></a></div>
<div dir="ltr"></div>
<div dir="ltr">my files:</div>
<div dir="ltr"></div>
<div dir="ltr"><strong><span style="color: #3366ff;">grid.php</span></strong></div>
<div dir="ltr"></div>
<div dir="ltr"></div>
<div dir="ltr">&#60;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&#62;<br />&#60;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&#62;<br />&#60;head&#62;<br />&#60;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&#62;<br />&#60;title&#62;Primera matriz&#60;/title&#62;<br />&#160;<br />&#60;link rel="stylesheet" type="text/css" media="screen" href="css/vader/jquery-ui-1.8.custom.css" /&#62;<br />&#60;link rel="stylesheet" type="text/css" media="screen" href="css/ui.jqgrid.css" /&#62;<br />&#160;<br />&#60;script src="js/jquery-1.4.2.min.js" type="text/javascript"&#62;&#60;/script&#62;<br />&#60;script src="js/i18n/grid.locale-sp.js" type="text/javascript"&#62;&#60;/script&#62;<br />&#60;script src="js/jquery.jqGrid.min.js" type="text/javascript"&#62;&#60;/script&#62;</p>
<p>&#60;script type="text/javascript"&#62;<br />jQuery(document).ready(function(){ <br />&#160; jQuery("#list").jqGrid({<br />&#160;&#160;&#160; url:&#39;ejemplo.php?q=1&#39;,<br />&#160;&#160;&#160; datatype: &#39;json&#39;,<br />&#160;&#160;&#160; mtype: &#39;POST&#39;,<br />&#160;&#160;&#160; colNames:[&#39;Inv No&#39;,&#39;Fecha&#39;, &#39;Monto&#39;,&#39;Impuesto&#39;,&#39;Total&#39;,&#39;Notas&#39;],<br />&#160;&#160;&#160; colModel :[ <br />&#160;&#160;&#160;&#160;&#160; {name:&#39;invid&#39;, index:&#39;invid&#39;, width:55}, <br />&#160;&#160;&#160;&#160;&#160; {name:&#39;invdate&#39;, index:&#39;invdate&#39;, width:90}, <br />&#160;&#160;&#160;&#160;&#160; {name:&#39;amount&#39;, index:&#39;amount&#39;, width:80, align:&#39;right&#39;}, <br />&#160;&#160;&#160;&#160;&#160; {name:&#39;tax&#39;, index:&#39;tax&#39;, width:80, align:&#39;right&#39;}, <br />&#160;&#160;&#160;&#160;&#160; {name:&#39;total&#39;, index:&#39;total&#39;, width:80, align:&#39;right&#39;}, <br />&#160;&#160;&#160;&#160;&#160; {name:&#39;note&#39;, index:&#39;note&#39;, width:150, sortable:false} <br />&#160;&#160;&#160; ],<br />&#160;&#160;&#160; pager: &#39;#pager&#39;, /* indica el elemento donde ir la barra de paginacin*/ <br />&#160;&#160;&#160; rowNum:10,<br />&#160;&#160;&#160; rowList:[5,10,15,20,25,30],<br />&#160;&#160;&#160; sortname: &#39;invid&#39;,<br />&#160;&#160;&#160; sortorder: &#39;desc&#39;,<br />&#160;&#160;&#160; viewrecords: true,<br />&#160;&#160;&#160; caption: &#39;Mi primera matriz de datos con JqGrid&#39;<br />&#160; }); <br />jQuery("#list").jqGrid(&#39;navGrid&#39;,&#39;#pager&#39;,{edit:false,add:false,del:false}); <br />}); <br />&#60;/script&#62;</p>
<p>&#160;<br />&#60;/head&#62;<br />&#60;body&#62;<br />&#60;table id="list"&#62;&#60;/table&#62; <br />&#60;div id="pager"&#62;&#60;/div&#62; <br />&#60;/body&#62;<br />&#60;/html&#62;</p>
</div>
<div dir="ltr"></div>
<div dir="ltr"></div>
<div dir="ltr"></div>
<div dir="ltr"></div>
<div dir="ltr"></div>
<div dir="ltr"></div>
<div dir="ltr"></div>
<div dir="ltr"></div>
<div dir="ltr"><strong><span style="color: #3366ff;">ejemplo.php</span></strong></div>
<div dir="ltr"></div>
<div dir="ltr"></div>
<div dir="ltr">&#60;?php<br />include("dbconfig.php");<br />// coment the above lines if php 5<br />//include("JSON.php");<br />//$json = new Services_JSON();<br />// end comment<br />$examp = $_REQUEST["q"]; //query number</p>
<p>$page = $_REQUEST[&#39;page&#39;]; // get the requested page<br />$limit = $_REQUEST[&#39;rows&#39;]; // get how many rows we want to have into the grid<br />$sidx = $_REQUEST[&#39;sidx&#39;]; // get index row - i.e. user click to sort<br />$sord = $_REQUEST[&#39;sord&#39;]; // get the direction<br />if(!$sidx) $sidx =1;</p>
<p>$wh = "";<br />$searchOn = Strip($_REQUEST[&#39;_search&#39;]);<br />if($searchOn==&#39;true&#39;) {<br />&#160;&#160; &#160;$sarr = Strip($_REQUEST);<br />&#160;&#160; &#160;foreach( $sarr as $k=&#62;$v) {<br />&#160;&#160; &#160;&#160;&#160; &#160;switch ($k) {<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;case &#39;invid&#39;:<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;case &#39;invdate&#39;:<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;case &#39;note&#39;:<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;$wh .= " AND ".$k." LIKE &#39;".$v."%&#39;";<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;break;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;case &#39;amount&#39;:<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;case &#39;tax&#39;:<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;case &#39;total&#39;:<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;$wh .= " AND ".$k." = ".$v;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;break;<br />&#160;&#160; &#160;&#160;&#160; &#160;}<br />&#160;&#160; &#160;}<br />}<br />//echo $wh;<br />// connect to the database<br />$db = mysql_connect($dbhost, $dbuser, $dbpassword)<br />or die("Connection Error: " . mysql_error());</p>
<p>mysql_select_db($dbs) or die("Error conecting to db.");</p>
<p>switch ($examp) {<br />&#160;&#160;&#160; case 1:<br />&#160;&#160; &#160;&#160;&#160; &#160;$result = mysql_query("SELECT COUNT(*) AS count FROM invheader".$wh);<br />&#160;&#160; &#160;&#160;&#160; &#160;$row = mysql_fetch_array($result,MYSQL_ASSOC);<br />&#160;&#160; &#160;&#160;&#160; &#160;$count = $row[&#39;count&#39;];</p>
<p>&#160;&#160; &#160;&#160;&#160; &#160;if( $count &#62;0 ) {<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;$total_pages = ceil($count/$limit);<br />&#160;&#160; &#160;&#160;&#160; &#160;} else {<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;$total_pages = 0;<br />&#160;&#160; &#160;&#160;&#160; &#160;}<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; if ($page &#62; $total_pages) $page=$total_pages;<br />&#160;&#160; &#160;&#160;&#160; &#160;$start = $limit*$page - $limit; // do not put $limit*($page - 1)<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; if ($start&#60;0) $start = 0;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; $SQL = "SELECT invid, invdate, amount, tax,total, note FROM invheader".$wh." ORDER BY ".$sidx." ".$sord. " LIMIT ".$start." , ".$limit;<br />&#160;&#160; &#160;&#160;&#160; &#160;$result = mysql_query( $SQL ) or die("Could not execute query.".mysql_error());<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; $responce-&#62;page = $page;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; $responce-&#62;total = $total_pages;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; $responce-&#62;records = $count;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; $i=0;<br />&#160;&#160; &#160;&#160;&#160; &#160;while($row = mysql_fetch_array($result,MYSQL_ASSOC)) {<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;$responce-&#62;rows[$i][&#39;invid&#39;]=$row[&#39;invid&#39;];<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $responce-&#62;rows[$i][&#39;cell&#39;]=array($row[&#39;invid&#39;],$row[&#39;invdate&#39;],$row[&#39;amount&#39;],$row[&#39;tax&#39;],$row[&#39;total&#39;],$row[&#39;note&#39;]);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $i++;<br />&#160;&#160; &#160;&#160;&#160; &#160;} <br />&#160;&#160; &#160;&#160;&#160; &#160;//echo $json-&#62;encode($responce); // coment if php 5<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; echo json_encode($responce);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; break;<br />&#160;&#160;&#160; case 3:<br />}<br />mysql_close($db);</p>
<p>function Strip($value)<br />{<br />&#160;&#160; &#160;if(get_magic_quotes_gpc() != 0)<br />&#160; &#160;&#160; &#160;{<br />&#160;&#160; &#160;&#160;&#160; &#160;if(is_array($value)) &#160;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;if ( array_is_associative($value) )<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;{<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;foreach( $value as $k=&#62;$v)<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;$tmp_val[$k] = stripslashes($v);<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;$value = $tmp_val; <br />&#160;&#160; &#160;&#160;&#160; &#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;else &#160;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;for($j = 0; $j &#60; sizeof($value); $j++)<br />&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;$value[$j] = stripslashes($value[$j]);<br />&#160;&#160; &#160;&#160;&#160; &#160;else<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;$value = stripslashes($value);<br />&#160;&#160; &#160;}<br />&#160;&#160; &#160;return $value;<br />}<br />function array_is_associative ($array)<br />{<br />&#160;&#160;&#160; if ( is_array($array) &#38;&#38; ! empty($array) )<br />&#160;&#160;&#160; {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; for ( $iterator = count($array) - 1; $iterator; $iterator-- )<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if ( ! array_key_exists($iterator, $array) ) { return true; }<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; return ! array_key_exists(0, $array);<br />&#160;&#160;&#160; }<br />&#160;&#160;&#160; return false;<br />}<br />?&#62;</p>
</div>
<div dir="ltr"></div>
<div dir="ltr">Help, please.</div>
<div dir="ltr"></div>
]]></description>
        	        	<pubDate>Sun, 30 May 2010 01:15:01 +0300</pubDate>
        </item>
</channel>
</rss>