<?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: Beginer Search box no result please help</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/beginer-search-box-no-result-please-help</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/beginer-search-box-no-result-please-help/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>newuser on Beginer Search box no result please help</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/beginer-search-box-no-result-please-help#p13351</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/beginer-search-box-no-result-please-help#p13351</guid>
        	        	<description><![CDATA[<p>Hello, well I think the reason why your filter isn&#39;t working is because of your MySQL syntax. After your FROM table_name statement add WHERE 1 = 1</p>
</p>
<p>this way when you try to filter it will work correctly because the php code expects a where clause to already exist and in MySQL you can not have two where clauses as it will return a syntax error.</p>
]]></description>
        	        	<pubDate>Sat, 26 Dec 2009 20:24:26 +0200</pubDate>
        </item>
        <item>
        	<title>anakin on Beginer Search box no result please help</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/beginer-search-box-no-result-please-help#p12992</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/beginer-search-box-no-result-please-help#p12992</guid>
        	        	<description><![CDATA[<p>Hi</p>
<p>I ve checked server.php and rewritted it completly and kept only the first example case.</p>
<p>still have the datas but can&#39;t perfom search.</p>
<p>When i click search button i&#39;ve got an error jquery.js object required at line 12</p>
<p>below my server.php content</p>
</p>
<p>&#60;?php <br />include("dbconfig.php");</p>
<p>$page = $_GET[&#39;page&#39;]; <br />$limit = $_GET[&#39;rows&#39;]; <br />$sidx = $_GET[&#39;sidx&#39;]; <br />$sord = $_GET[&#39;sord&#39;]; <br />&#160;<br />if(!$sidx) $sidx =1; </p>
<p>$searchOn = Strip($_REQUEST[&#39;_search&#39;]);<br />if($searchOn==&#39;true&#39;) {<br />&#160;&#160;&#160; $fld = Strip($_REQUEST[&#39;searchField&#39;]);<br />&#160;&#160;&#160; if( $fld==&#39;id&#39; &#124;&#124; $fld ==&#39;numero&#39; &#124;&#124; $fld==&#39;organisme&#39;) {<br />&#160;&#160;&#160; &#160;&#160;&#160; $fldata = Strip($_REQUEST[&#39;searchString&#39;]);<br />&#160;&#160;&#160; &#160;&#160;&#160; $foper = Strip($_REQUEST[&#39;searchOper&#39;]);<br />&#160;&#160;&#160; &#160;&#160;&#160; // costruct where<br />&#160;&#160;&#160; &#160;&#160;&#160; $wh .= " AND ".$fld;<br />&#160;&#160;&#160; &#160;&#160;&#160; switch ($foper) {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; case "bw":<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $fldata .= "%";<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $wh .= " LIKE &#39;".$fldata."&#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 "eq":<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if(is_numeric($fldata)) {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $wh .= " = ".$fldata;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; } else {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $wh .= " = &#39;".$fldata."&#39;";<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; }<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 "ne":<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if(is_numeric($fldata)) {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $wh .= " &#60;&#62; ".$fldata;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; } else {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $wh .= " &#60;&#62; &#39;".$fldata."&#39;";<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; }<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 "lt":<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if(is_numeric($fldata)) {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $wh .= " &#60; ".$fldata;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; } else {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $wh .= " &#60; &#39;".$fldata."&#39;";<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; }<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 "le":<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if(is_numeric($fldata)) {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $wh .= " &#60;= ".$fldata;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; } else {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $wh .= " &#60;= &#39;".$fldata."&#39;";<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; }<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 "gt":<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if(is_numeric($fldata)) {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $wh .= " &#62; ".$fldata;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; } else {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $wh .= " &#62; &#39;".$fldata."&#39;";<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; }<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 "ge":<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if(is_numeric($fldata)) {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $wh .= " &#62;= ".$fldata;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; } else {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $wh .= " &#62;= &#39;".$fldata."&#39;";<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; }<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 "ew":<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $wh .= " LIKE &#39;%".$fldata."&#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 "ew":<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $wh .= " LIKE &#39;%".$fldata."%&#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; default :<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $wh = "";<br />&#160;&#160;&#160; &#160;&#160;&#160; }<br />&#160;&#160;&#160; }<br />}</p>
<p>&#160;<br />$db = mysql_connect($dbhost, $dbuser, $dbpassword)or die("Connection Error: " . mysql_error());<br />mysql_select_db($database) or die("Error conecting to db.");</p>
<p>$result = mysql_query("SELECT COUNT(*) AS count FROM organismes ".$wh);</p>
<p>$row = mysql_fetch_array($result,MYSQL_ASSOC); <br />$count = $row[&#39;count&#39;]; <br />&#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;</p>
<p>$SQL = "SELECT numero, organisme, maj FROM organismes".$wh." ORDER BY ".$sidx." ". $sord." LIMIT ".$start." , ".$limit;<br />$result = mysql_query( $SQL ) or die("Couldn&#39;t execute query.".mysql_error()); <br />&#160;<br />if ( stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml") ) {<br />header("Content-type: application/xhtml+xml;charset=utf-8"); } else { <br />header("Content-type: text/xml;charset=utf-8"); <br />} $et = "&#62;"; <br />echo "&#60;?xml version=&#39;1.0&#39; encoding=&#39;utf-8&#39;?$et\\n"; </p>
<p>$s .=&#160; "&#60;rows&#62;";<br />$s .= "&#60;page&#62;".$page."&#60;/page&#62;";<br />$s .= "&#60;total&#62;".$total_pages."&#60;/total&#62;";<br />$s .= "&#60;records&#62;".$count."&#60;/records&#62;";<br />&#160;<br />// be sure to put text data in CDATA<br />while($row = mysql_fetch_array($result,MYSQL_ASSOC)) {<br />&#160;&#160;&#160; $s .= "&#60;row id=&#39;". $row[numero]."&#39;&#62;";&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160; $s .= "&#60;cell&#62;". $row[numero]."&#60;/cell&#62;";<br />&#160;&#160;&#160; $s .= "&#60;cell&#62;&#60;![CDATA[". $row[organisme]."]]&#62;&#60;/cell&#62;";<br />&#160;&#160;&#160; $s .= "&#60;cell&#62;". $row[maj]."&#60;/cell&#62;";<br />&#160;&#160;&#160; $s .= "&#60;/row&#62;";<br />}<br />$s .= "&#60;/rows&#62;"; <br />&#160;<br />echo $s;</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>
]]></description>
        	        	<pubDate>Mon, 14 Dec 2009 13:34:28 +0200</pubDate>
        </item>
        <item>
        	<title>tony on Beginer Search box no result please help</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/beginer-search-box-no-result-please-help#p12964</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/beginer-search-box-no-result-please-help#p12964</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>For me everthing is working correct. You should check your server side code on how you accept the parameters from</p>
<p>the search dialog and how you perform the serch. Again in the demo package there is such one. Just look at server.php file from</p>
<p>the same package.</p>
<p>Best Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Sun, 13 Dec 2009 17:40:43 +0200</pubDate>
        </item>
        <item>
        	<title>anakin on Beginer Search box no result please help</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/beginer-search-box-no-result-please-help#p12935</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/beginer-search-box-no-result-please-help#p12935</guid>
        	        	<description><![CDATA[<p>the first one show you where i install jqgrid and : <a href="http://www.nord-international.fr/dripe/test%20tableaux/grid.html" rel="nofollow" target="_blank"><a href="http://www.nord-international" rel="nofollow">http://www.nord-international</a>....../grid.html</a> is my custom example</p>
]]></description>
        	        	<pubDate>Fri, 11 Dec 2009 18:54:31 +0200</pubDate>
        </item>
        <item>
        	<title>anakin on Beginer Search box no result please help</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/beginer-search-box-no-result-please-help#p12934</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/beginer-search-box-no-result-please-help#p12934</guid>
        	        	<description><![CDATA[<p>sorry <a href="http://www.nord-international.fr/dripe/test%20tableaux/jqgrid.html" rel="nofollow" target="_blank"><a href="http://www.nord-international" rel="nofollow">http://www.nord-international</a>......qgrid.html</a></p>
</p>
<p>thanks again</p>
]]></description>
        	        	<pubDate>Fri, 11 Dec 2009 18:53:14 +0200</pubDate>
        </item>
        <item>
        	<title>tony on Beginer Search box no result please help</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/beginer-search-box-no-result-please-help#p12914</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/beginer-search-box-no-result-please-help#p12914</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>Sorry, the link does not work for me.</p>
<p>Best Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Fri, 11 Dec 2009 01:09:20 +0200</pubDate>
        </item>
        <item>
        	<title>any on Beginer Search box no result please help</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/beginer-search-box-no-result-please-help#p12859</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/beginer-search-box-no-result-please-help#p12859</guid>
        	        	<description><![CDATA[<p>Hello</p>
</p>
<p>Thank you for you fast reply and sorry for my bad english. I ve developped by myself an application for my job (local authoritiy/international cooperation). Application was at the beginning created on local network with ms access, access data pages and html intranet pages with some js scripts. Now i&#39;m trying to create "real" website with mysql, php... that&#39;s new&#160; for me. As i told you in my first post, i&#39;m succeded in created page to display datas with jqgrid. I&#39;m able to sort datas by columns and apply my working language plugin (french), the refresh option is working too i think&#160; but when search box is loaded and after appllying filter nothing happen. Please see the test page at <a href="http://www.nord-international.fr/dripe/grid.html" rel="nofollow" target="_blank"><a href="http://www.nord-international" rel="nofollow">http://www.nord-international</a>....../grid.html</a>. Please ask me if you need further informations. The code i&#39;ve posted is the one i used and it&#39;s working to sort datas, so i don&#39;t understand your question...</p>
<p>Thanks again for your help best regards</p>
]]></description>
        	        	<pubDate>Wed, 09 Dec 2009 01:30:38 +0200</pubDate>
        </item>
        <item>
        	<title>tony on Beginer Search box no result please help</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/beginer-search-box-no-result-please-help#p12827</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/beginer-search-box-no-result-please-help#p12827</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>In your script there is nothing when you perform sort. Could you please see how this is done into the demo in order to have idea what to do.</p>
<p>Best Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Tue, 08 Dec 2009 18:22:20 +0200</pubDate>
        </item>
        <item>
        	<title>any on Beginer Search box no result please help</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/beginer-search-box-no-result-please-help#p12806</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/beginer-search-box-no-result-please-help#p12806</guid>
        	        	<description><![CDATA[<p>Hello</p>
<p>I&#39;ve downloaded and installed jqgrid 3.6.1 and succeded in display datas form mysql database. I&#39;m able to sort datas by clicking columns, show 10 20 or 30 records in grid, go to the next records... and open search box. Problem is when I&#39;m click searching datas are not filtered.</p>
<p>Thank you for your help</p>
<p>html page</p>
<p><input type='button' class='sfcodeselect' name='sfselectit9881' value='Select Code' data-codeid='sfcode9881' /></p>
<div class='sfcode' id='sfcode9881'>
<pre id="line1"><span class="doctype">&#60;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&#62;</span><br />&#60;<span class="start-tag">html</span><span class="attribute-name"> xmlns</span>=<span class="attribute-value">"http://www.w3.org/1999/xhtml" </span><span class="attribute-name">xml:lang</span>=<span class="attribute-value">"en" </span><span class="attribute-name">lang</span>=<span class="attribute-value">"en"</span>&#62;<br />&#60;<span class="start-tag">head</span>&#62;<br />&#60;<span class="start-tag">meta</span><span class="attribute-name"> http-equiv</span>=<span class="attribute-value">"Content-Type" </span><span class="attribute-name">content</span>=<span class="attribute-value">"text/html; charset=utf-8"</span>&#62;<br />&#60;<span class="start-tag">title</span>&#62;My First Grid&#60;/<span class="end-tag">title</span>&#62;<br /> <br />&#60;<span class="start-tag">link</span><span class="attribute-name"> rel</span>=<span class="attribute-value">"stylesheet" </span><span class="attribute-name">type</span>=<span class="attribute-value">"text/css" </span><span class="attribute-name">media</span>=<span class="attribute-value">"screen" </span><span class="attribute-name">href</span>=<span class="attribute-value">"css/ui-lightness/jquery-ui-1.7.2.custom.css"</span>&#62;<br />&#60;<span class="start-tag">link</span><span class="attribute-name"> rel</span>=<span class="attribute-value">"stylesheet" </span><span class="attribute-name">type</span>=<span class="attribute-value">"text/css" </span><span class="attribute-name">media</span>=<span class="attribute-value">"screen" </span><span class="attribute-name">href</span>=<span class="attribute-value">"css/ui.jqgrid.css"</span>&#62;<br />&#60;<span class="start-tag">link</span><span class="attribute-name"> rel</span>=<span class="attribute-value">"stylesheet" </span><span class="attribute-name">type</span>=<span class="attribute-value">"text/css" </span><span class="attribute-name">media</span>=<span class="attribute-value">"screen" </span><span class="attribute-name">href</span>=<span class="attribute-value">"css/jquery.searchFilter.css"</span>&#62;<br /> <br />&#60;<span class="start-tag">style</span>&#62;<br />html, body {<br />    margin: 0;<br />    padding: 0;<br />    font-size: 75%;<br />}<br />&#60;/<span class="end-tag">style</span>&#62;<br />&#60;<span class="start-tag">script</span><span class="attribute-name"> src</span>=<span class="attribute-value">"js/jquery-1.3.2.min.js" </span><span class="attribute-name">type</span>=<span class="attribute-value">"text/javascript"</span>&#62;&#60;/<span class="end-tag">script</span>&#62;<br />&#60;<span class="start-tag">script</span><span class="attribute-name"> src</span>=<span class="attribute-value">"js/i18n/grid.locale-fr.js" </span><span class="attribute-name">type</span>=<span class="attribute-value">"text/javascript"</span>&#62;&#60;/<span class="end-tag">script</span>&#62;<br /></pre>
<pre id="line20">&#60;<span class="start-tag">script</span><span class="attribute-name"> type</span>=<span class="attribute-value">"text/javascript"</span>&#62;<br />	jQuery.jgrid.useJSON = true;<br />&#60;/<span class="end-tag">script</span>&#62;<br />&#60;<span class="start-tag">script</span><span class="attribute-name"> src</span>=<span class="attribute-value">"js/jquery.jqGrid.min.js" </span><span class="attribute-name">type</span>=<span class="attribute-value">"text/javascript"</span>&#62;&#60;/<span class="end-tag">script</span>&#62;<br />&#60;<span class="start-tag">script</span><span class="attribute-name"> type</span>=<span class="attribute-value">"text/javascript"</span>&#62;<br />   jQuery.extend(jQuery.jgrid,{<br />      parse:function(jsstring) {<br />         return JSON.parse(jsstring);<br />      }<br />   });<br />&#60;/<span class="end-tag">script</span>&#62;<br /><br /><br /><br /><br />&#60;<span class="start-tag">script</span><span class="attribute-name"> type</span>=<span class="attribute-value">"text/javascript"</span>&#62;<br />jQuery().ready(function (){ <br />  jQuery("#list").jqGrid({<br />    url:&#39;grid.php?q=1&#39;,<br />    datatype: &#39;xml&#39;,<br />    colNames:[&#39;numero&#39;,&#39;organisme&#39;, &#39;maj&#39;],<br />    colModel :[ <br />      {name:&#39;NUM&#39;, index:&#39;numero&#39;, width:55}, <br />      {name:&#39;ORG&#39;, index:&#39;organisme&#39;, width:90}, <br />      {name:&#39;MAJ&#39;, index:&#39;maj&#39;, width:80, align:&#39;right&#39;}<br />    ],<br />    pager: &#39;#pager&#39;,<br />    rowNum:10,<br />    rowList:[10,20,30],<br />    sortname: &#39;numero&#39;,<br />    sortorder: &#39;desc&#39;,<br />    viewrecords: true,<br />    caption: &#39;My first grid&#39;,<br />    sortname: &#39;numero&#39;, <br />        width:800,<br />    height:400,<br /><br />  }); jQuery("#list").jqGrid(&#39;navGrid&#39;,&#39;#pager&#39;,{edit:true,add:false,del:false});<br /><br />jQuery("#s2").click( function() { jQuery("#list").jqGrid(&#39;setGridParam&#39;,{sortname:"numero",sortorder:"asc"}).trigger("reloadGrid");<br />  }); <br />jQuery("#s1").click (function() { jQuery("#list").searchGrid( {sopt:[&#39;cn&#39;,&#39;bw&#39;,&#39;eq&#39;,&#39;ne&#39;,&#39;lt&#39;,&#39;gt&#39;,&#39;ew&#39;]} ); <br /> }); <br />  }); <br />&#60;/<span class="end-tag">script</span>&#62;<br /> <br />&#60;/<span class="end-tag">head</span>&#62;<br />&#60;<span class="start-tag">body</span>&#62;<br />&#60;<span class="start-tag">table</span><span class="attribute-name"> id</span>=<span class="attribute-value">"list"</span>&#62;&#60;/<span class="end-tag">table</span>&#62; <br />&#60;<span class="start-tag">div</span><span class="attribute-name"> id</span>=<span class="attribute-value">"pager"</span>&#62;&#60;/<span class="end-tag">div</span>&#62; <br /></pre>
<pre id="line70">&#60;<span class="start-tag">a</span><span class="attribute-name"> href</span>=<span class="attribute-value">"javascript:void(0)" </span><span class="attribute-name">id</span>=<span class="attribute-value">"s2"</span>&#62;Set Sort to amount column&#60;/<span class="end-tag">a</span>&#62;&#60;<span class="start-tag">a</span><span class="attribute-name"> href</span>=<span class="attribute-value">"javascript:void(0)" </span><span class="attribute-name">id</span>=<span class="attribute-value">"s1"</span>&#62;Seaerch&#60;/<span class="end-tag">a</span>&#62;<br />&#60;/<span class="end-tag">body</span>&#62;<br />&#60;/<span class="end-tag">html</span>&#62;</pre>
</div>
<pre id="line70"><br />php file<br /><br /></pre>
<p><input type='button' class='sfcodeselect' name='sfselectit1145' value='Select Code' data-codeid='sfcode1145' /></p>
<div class='sfcode' id='sfcode1145'>&#60;?php </p>
<p>$page = $_GET[&#39;page&#39;]; </p>
<p>// get how many rows we want to have into the grid - rowNum parameter in the grid <br />$limit = $_GET[&#39;rows&#39;]; </p>
<p>// get index row - i.e. user click to sort. At first time sortname parameter -<br />// after that the index from colModel <br />$sidx = $_GET[&#39;sidx&#39;]; </p>
<p>// sorting order - at first time sortorder <br />$sord = $_GET[&#39;sord&#39;]; </p>
<p>// if we not pass at first time index use the first column for the index or what you want<br />if(!$sidx) $sidx =1; </p>
<p>mysql_connect("localhost", "xxxxxx", "xxxxxx") or die("Connection Error: " . mysql_error()); <br />mysql_select_db("BDDRIPEINTRANET") or die("Connection Error: " . mysql_error()); </p>
<p>// calculate the number of rows for the query. We need this for paging the result <br />$result = mysql_query("SELECT COUNT(*) AS count FROM organismes"); <br />$row = mysql_fetch_array($result,MYSQL_ASSOC); <br />$count = $row[&#39;count&#39;]; </p>
<p>// calculate the total pages for the query <br />if( $count &#62; 0 &#38;&#38; $limit &#62; 0) { <br /> $total_pages = ceil($count/$limit); <br />} else { <br /> $total_pages = 0; <br />} </p>
<p>// if for some reasons the requested page is greater than the total <br />// set the requested page to total page <br />if ($page &#62; $total_pages) $page=$total_pages;</p>
<p>// calculate the starting position of the rows <br />$start = $limit*$page - $limit;</p>
<p>// if for some reasons start position is negative set it to 0 <br />// typical case is that the user type 0 for the requested page <br />if($start &#60;0) $start = 0; </p>
<p>// the actual query for the grid data <br />$SQL = "SELECT numero, organisme, maj FROM organismes ORDER BY $sidx $sord LIMIT $start , $limit";<br />$result = mysql_query( $SQL ) or die("Couldn&#39;t execute A.".mysql_error()); </p>
<p>if ( stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml") ) {<br />header("Content-type: application/xhtml+xml;charset=utf-8"); } else { <br />header("Content-type: text/xml;charset=utf-8"); <br />} $et = "&#62;"; <br />echo "&#60;?xml version=&#39;1.0&#39; encoding=&#39;utf-8&#39;?$et\\n"; </p>
<p>$s .=  "&#60;rows&#62;";<br />$s .= "&#60;page&#62;".$page."&#60;/page&#62;";<br />$s .= "&#60;total&#62;".$total_pages."&#60;/total&#62;";<br />$s .= "&#60;records&#62;".$count."&#60;/records&#62;";</p>
<p>// be sure to put text data in CDATA<br />while($row = mysql_fetch_array($result,MYSQL_ASSOC)) {<br /> $s .= "&#60;row id=&#39;". $row[numero]."&#39;&#62;";            <br /> $s .= "&#60;cell&#62;". $row[numero]."&#60;/cell&#62;";<br /> $s .= "&#60;cell&#62;". $row[organisme]."&#60;/cell&#62;";<br /> $s .= "&#60;cell&#62;&#60;![CDATA[".$row[organisme]."]]&#62;&#60;/cell&#62;";<br /> $s .= "&#60;cell&#62;". $row[maj]."&#60;/cell&#62;";<br /> $s .= "&#60;cell&#62;&#60;![CDATA[".$row[maj]."]]&#62;&#60;/cell&#62;";<br /> $s .= "&#60;/row&#62;";<br />}<br />$s .= "&#60;/rows&#62;"; </p>
<p>echo $s;<br />?&#62;</p>
</div>
<pre id="line70"><br /></pre>
]]></description>
        	        	<pubDate>Tue, 08 Dec 2009 00:15:59 +0200</pubDate>
        </item>
</channel>
</rss>