<?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:  GRID DOES NOT SHOW DATA</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/grid-does-not-show-data</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/grid-does-not-show-data/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>emily on  GRID DOES NOT SHOW DATA</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/grid-does-not-show-data#p25875</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/grid-does-not-show-data#p25875</guid>
        	        	<description><![CDATA[<p>How I will check the xml that example.php outputs?</p>
]]></description>
        	        	<pubDate>Sun, 05 Feb 2012 18:41:27 +0200</pubDate>
        </item>
        <item>
        	<title>chrismark on  GRID DOES NOT SHOW DATA</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/grid-does-not-show-data#p25873</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/grid-does-not-show-data#p25873</guid>
        	        	<description><![CDATA[<p>Check the xml that example.php outputs.</p>
<p>header("Content-type: text/xml;charset=utf-8&#8243;); &#60;-- last double quote here doesn&#39;t look right.</p>
]]></description>
        	        	<pubDate>Sun, 05 Feb 2012 18:33:04 +0200</pubDate>
        </item>
        <item>
        	<title>emily on  GRID DOES NOT SHOW DATA</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/grid-does-not-show-data#p25870</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/grid-does-not-show-data#p25870</guid>
        	        	<description><![CDATA[<p>Hello!</p>
<p>I did the basic installation but I dont display any data on the grid!</p>
<p>Here is the example.php code:</p>
<p>&#60;?php <br />//include the information needed for the connection to MySQL data base server. <br />// we store here username, database and password <br />include("connect1.php");<br />&#160;<br />// to the url parameter are added 4 parameters as described in colModel<br />// we should get these parameters to construct the needed query<br />// Since we specify in the options of the grid that we will use a GET method <br />// we should use the appropriate command to obtain the parameters. <br />// In our case this is $_GET. If we specify that we want to use post <br />// we should use $_POST. Maybe the better way is to use $_REQUEST, which<br />// contain both the GET and POST variables. For more information refer to php documentation.<br />// Get the requested page. By default grid sets this to 1. <br />$page = $_GET[&#39;page&#39;]; <br />&#160;<br />// get how many rows we want to have into the grid - rowNum parameter in the grid <br />$limit = $_GET[&#39;rows&#39;]; <br />&#160;<br />// 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;]; <br />&#160;<br />// sorting order - at first time sortorder <br />$sord = $_GET[&#39;sord&#39;]; <br />&#160;<br />// if we not pass at first time index use the first column for the index or what you want<br />if(!$sidx) $sidx =1; <br />&#160;</p>
<p>&#160;<br />// calculate the number of rows for the query. We need this for paging the result <br />$result = mysql_query("SELECT COUNT(*) AS count FROM users"); <br />$row = mysql_fetch_array($result,MYSQL_ASSOC); <br />$count = $row[&#39;count&#39;]; <br />&#160;<br />// calculate the total pages for the query <br />if( $count &#62; 0 &#38;&#38; $limit &#62; 0) { <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $total_pages = ceil($count/$limit); <br />} else { <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $total_pages = 0; <br />} <br />&#160;<br />// 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;<br />&#160;<br />// calculate the starting position of the rows <br />$start = $limit*$page - $limit;<br />&#160;<br />// 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; <br />&#160;<br />// the actual query for the grid data <br />$SQL = "SELECT first_name, last_name, occupation, address,email, telephone_a FROM users,identity_card ORDER BY $sidx $sord LIMIT $start , $limit"; <br />$result = mysql_query( $SQL ) or die("Couldn&#39;t execute query.".mysql_error()); <br />&#160;<br />// we should set the appropriate header information. Do not forget this.<br />header("Content-type: text/xml;charset=utf-8");<br />&#160;<br />$s = "&#60;?xml version=&#39;1.0&#39; encoding=&#39;utf-8&#39;?&#62;";<br />$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[&#39;identity_card&#39;]."&#39;&#62;";&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;<br />&#160;&#160;&#160; $s .= "&#60;cell&#62;". $row[&#39;identity_card&#39;]."&#60;/cell&#62;";<br />&#160;&#160;&#160; $s .= "&#60;cell&#62;". $row[&#39;last_name&#39;]."&#60;/cell&#62;";<br />&#160;&#160;&#160; $s .= "&#60;cell&#62;". $row[&#39;occupation&#39;]."&#60;/cell&#62;";<br />&#160;&#160;&#160; $s .= "&#60;cell&#62;". $row[&#39;address&#39;]."&#60;/cell&#62;";<br />&#160;&#160;&#160; $s .= "&#60;cell&#62;". $row[&#39;email&#39;]."&#60;/cell&#62;";<br />&#160;&#160; &#160;$s .= "&#60;cell&#62;". $row[&#39;first_name&#39;]."&#60;/cell&#62;";<br />&#160;&#160;&#160; $s .= "&#60;cell&#62;&#60;![CDATA[". $row[&#39;telephone_a&#39;]."]]&#62;&#60;/cell&#62;";<br />&#160;&#160;&#160; $s .= "&#60;/row&#62;";<br />}<br />$s .= "&#60;/rows&#62;"; <br />&#160;<br />echo $s;<br />?&#62;</p>
</p>
<p>And here is the myfirstgrid.html :</p>
<p>&#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;My First Grid&#60;/title&#62;<br />&#160;<br />&#60;link rel="stylesheet" type="text/css" media="screen" href="css/redmond/jquery-ui-1.8.17.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.5.2.min.js" type="text/javascript"&#62;&#60;/script&#62;<br />&#60;script src="js/i18n/grid.locale-en.js" type="text/javascript"&#62;&#60;/script&#62;<br />&#60;script src="js/jquery.jqGrid.min.js" type="text/javascript"&#62;&#60;/script&#62;<br />&#160;<br />&#60;script src="js/jqDnR.js" type="text/javascript"&#62;&#60;/script&#62;</p>
<p>&#60;script src="js/jqModal.js" type="text/javascript"&#62;&#60;/script&#62; <br />&#160;<br />&#160;&#60;style&#62;<br />html, body {<br />&#160;&#160;&#160; margin: 0;<br />&#160;&#160;&#160; padding: 0;<br />&#160;&#160;&#160; font-size: 75%;<br />}<br />&#60;/style&#62;</p>
<p>&#60;script type="text/javascript"&#62;<br />$(function(){ <br />&#160; $("#list").jqGrid({<br />&#160;&#160;&#160; url:&#39;example.php&#39;,<br />&#160;&#160;&#160; datatype: &#39;xml&#39;,<br />&#160;&#160;&#160; mtype: &#39;GET&#39;,<br />&#160;&#160;&#160; colNames:[&#39;&#932;&#945;&#965;&#964;ÏŒ&#964;&#951;&#964;&#945;&#39;,&#39;ÎŒ&#957;&#959;&#956;&#945;&#39;,&#39;&#917;&#960;Î¯&#952;&#949;&#964;&#959;&#39;, &#39;&#913;&#960;&#945;&#963;&#967;ÏŒ&#955;&#951;&#963;&#951;&#39;,&#39;&#916;&#953;&#949;Ï&#952;&#965;&#957;&#963;&#951;&#39;,&#39;&#917;mail&#39;,&#39;T&#951;&#955;Î­&#966;&#969;&#957;&#959;&#39;],<br />&#160;&#160;&#160; colModel :[ <br />&#160;&#160; &#160;&#160; {name:&#39;identity_card&#39;, index:&#39;identity_card&#39;, width:55},<br />&#160;&#160;&#160;&#160;&#160; {name:&#39;first_name&#39;, index:&#39;first_name&#39;, width:55}, <br />&#160;&#160;&#160;&#160;&#160; {name:&#39;last_name&#39;, index:&#39;last_name&#39;, width:90}, <br />&#160;&#160;&#160;&#160;&#160; {name:&#39;occupation&#39;, index:&#39;occupation&#39;, width:80, align:&#39;right&#39;}, <br />&#160;&#160;&#160;&#160;&#160; {name:&#39;address&#39;, index:&#39;address&#39;, width:80, align:&#39;right&#39;}, <br />&#160;&#160;&#160;&#160;&#160; {name:&#39;email&#39;, index:&#39;email&#39;, width:80, align:&#39;right&#39;}, <br />&#160;&#160;&#160;&#160;&#160; {name:&#39;telephone_a&#39;, index:&#39;telephone_a&#39;, width:150, sortable:false} <br />&#160;&#160;&#160; ],<br />&#160;&#160;&#160; pager: &#39;#pager&#39;,<br />&#160;&#160;&#160; rowNum:10,<br />&#160;&#160;&#160; rowList:[10,20,30],<br />&#160;&#160;&#160; sortname: &#39;identity_card&#39;,<br />&#160;&#160;&#160; sortorder: &#39;desc&#39;,<br />&#160;&#160;&#160; viewrecords: true,<br />&#160;&#160;&#160; gridview: true,<br />&#160;&#160;&#160; caption: &#39;My first grid&#39;<br />&#160; }); <br />}); <br />&#60;/script&#62;</p>
<p>&#60;/head&#62;<br />&#60;body&#62;<br />&#60;table id="list"&#62;&#60;tr&#62;&#60;td/&#62;&#60;/tr&#62;&#60;/table&#62; <br />&#60;div id="pager"&#62;&#60;/div&#62; <br />&#60;/body&#62;<br />&#60;/html&#62;</p>
</p>
<p>Does anyone see any mistakes?</p>
<p>I followed the instructions from this link for my first grid:</p>
<p><a href="http://www.trirand.com/jqgridwiki/doku.php?id=wiki:first_grid" rel="nofollow" target="_blank">http://www.trirand.com/jqgridwiki/doku.php?id=wiki:first_grid</a></p>
]]></description>
        	        	<pubDate>Sun, 05 Feb 2012 04:00:29 +0200</pubDate>
        </item>
</channel>
</rss>