<?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: Only First column displaying in JQGrid</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/only-first-column-displaying-in-jqgrid</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/only-first-column-displaying-in-jqgrid/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>dpotter on Only First column displaying in JQGrid</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/only-first-column-displaying-in-jqgrid#p29017</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/only-first-column-displaying-in-jqgrid#p29017</guid>
        	        	<description><![CDATA[<p>Update: It doesn&#39;t seem to be a problem with the server code; when I create the grid in an html page everything works fine. It has to be something to do with the initialization of the GridRender in the php page? Can anybody help? Thanks!!</p>
]]></description>
        	        	<pubDate>Mon, 17 Jun 2013 19:58:58 +0300</pubDate>
        </item>
        <item>
        	<title>dpotter on Only First column displaying in JQGrid</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/only-first-column-displaying-in-jqgrid#p29007</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/only-first-column-displaying-in-jqgrid#p29007</guid>
        	        	<description><![CDATA[<p>Hi,</p>
<p>I&#39;m a newbie to JQGrid - I&#39;m trying to use a separate server php page to populate the grid. The data appears to be in the grid in that I&#39;ve checked the JSON message and it exports data to excel. However only the first column displays. Can someone help please?</p>
<p>Thanks!</p>
<p>David</p>
<p>Grid Creator PHP FILE:</p>
<p>&#60;?php</p>
<p>/*<br />&#160;* To change this template, choose Tools &#124; Templates<br />&#160;* and open the template in the editor.<br />&#160;*/</p>
<p>require_once &#39;jq-config.php&#39;;<br />// include the jqGrid Class<br />require_once "php/jqGrid.php";<br />// include the PDO driver class<br />require_once "php/jqGridPdo.php";<br />// Connection to the server</p>
<p>// Create the jqGrid instance<br />$grid = new jqGridRender();<br />// Write the SQL Query</p>
<p>// set the ouput format to json<br />$grid-&#62;dataType = &#39;json&#39;;<br />// Let the grid create the model</p>
<p>$Model = array (<br />array ("name" =&#62; "id", "index"=&#62;"id"),<br />array ("name" =&#62; "account"),<br />array ("name" =&#62; "s_time", "width" =&#62; 40, "align" =&#62; "right"),<br />array ("name" =&#62; "s_ntime"," width "=&#62; 40," align "=&#62;" right "),<br />array ("name" =&#62; "lp"," width "=&#62; 40," align "=&#62;" right "),<br />array ("name" =&#62; "cp"," width "=&#62; 40," align "=&#62;" right "),<br />array ("name" =&#62; "side"," width "=&#62; 40," align "=&#62;" right "),<br />array ("name" =&#62; "ex_price"," width "=&#62; 40," align "=&#62;" right "),<br />array ("name" =&#62; "ex_size"," width "=&#62; 40," align "=&#62;" right "),<br />array ("name" =&#62; "order_price"," width "=&#62; 40," align "=&#62;" right "),<br />array ("name" =&#62; "order_size"," width "=&#62; 40," align "=&#62;" right "),<br />);</p>
<p>$grid-&#62;setColModel($Model);</p>
<p>$grid-&#62;setUrl(&#39;server.php&#39;);<br />// Set grid caption using the option caption<br />$grid-&#62;setGridOptions(array(<br />&#160;&#160;&#160; "caption"=&#62;"Orders",<br />&#160;&#160;&#160; "rowNum"=&#62;30,<br />&#160;&#160;&#160; "sortname"=&#62;"account",<br />&#160;&#160;&#160; "hoverrows"=&#62;true,<br />&#160;&#160;&#160; "rowList"=&#62;array(10,20,50),<br />&#160;&#160;&#160; "width"=&#62;1500,<br />&#160;&#160;&#160; "height"=&#62;100,<br />&#160;&#160;&#160; ));</p>
<p>$grid-&#62;renderGrid(&#39;#grid&#39;,&#39;#pager&#39;,true, null, null, true,true);</p>
<p>And server file:</p>
<p>&#60;?php<br />//include("dbconfig.php");</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>//$page = 1;<br />//$limit = 10;<br />//$sord = "ASC";<br />//$sidx = "id";</p>
<p>// connect to the database<br />$database = "test1";<br />$db = mysql_connect("localhost:3306", "root", "") or die("Connection Error: " . mysql_error());<br />mysql_select_db($database) or die("Error conecting to db.");<br />$result = mysql_query("SELECT COUNT(*) AS count FROM TEST2");<br />$row = mysql_fetch_array($result,MYSQL_ASSOC);<br />$count = $row[&#39;count&#39;];<br />if( $count &#62;0 ) {<br />$total_pages = ceil($count/$limit);<br />} else {<br />$total_pages = 0;<br />}</p>
<p>if ($page &#62; $total_pages) $page=$total_pages;<br />$start = $limit*$page - $limit; // do not put $limit*($page - 1)<br />if ($start&#60;0) $start = 0;<br />$SQL = "SELECT * FROM TEST2 ORDER BY ".$sidx." ".$sord. " LIMIT ".$start." , ".$limit;<br />$result = mysql_query( $SQL ) or die("Could not execute query.".mysql_error());<br />// Construct the json data</p>
<p>$response = new stdClass();</p>
<p>$response-&#62;page = $page; // current page<br />$response-&#62;total = $total_pages; // total pages<br />$response-&#62;records = $count; // total records<br />$i=0;<br />while($row = mysql_fetch_array($result,MYSQL_ASSOC)) {<br />$response-&#62;rows[$i][&#39;id&#39;]=$row[&#39;id&#39;]; //id <br />$response-&#62;rows[$i][&#39;cell&#39;]=array($row[&#39;id&#39;],$row[&#39;account&#39;],$row[&#39;s_time&#39;],$row[&#39;s_ntime&#39;],$row[&#39;lp&#39;],$row[&#39;cp&#39;],$row[&#39;side&#39;], $row[&#39;ex_price&#39;], $row[&#39;ex_size&#39;], $row[&#39;order_price&#39;], $row[&#39;order_size&#39;]);<br />$i++;<br />} </p>
<p>echo json_encode($response);</p>
<p>?&#62;</p></p>
]]></description>
        	        	<pubDate>Fri, 14 Jun 2013 16:35:49 +0300</pubDate>
        </item>
</channel>
</rss>