<?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 Rendering With No Data</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/grid-rendering-with-no-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-rendering-with-no-data/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>tony on Grid Rendering With No Data</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/grid-rendering-with-no-data#p22167</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/grid-rendering-with-no-data#p22167</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>It seems you use the commertial PHP jqGrid component.</p>
<p>Please post your question here.</p>
<p><a href="http://www.trirand.net/forum/" rel="nofollow" target="_blank">http://www.trirand.net/forum/</a></p>
<p>Also there is a&#160; forum topic regarding this problem.</p>
</p>
<p>Kind Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Tue, 22 Feb 2011 06:02:16 +0200</pubDate>
        </item>
        <item>
        	<title>Jeremy A on Grid Rendering With No Data</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/grid-rendering-with-no-data#p22166</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/grid-rendering-with-no-data#p22166</guid>
        	        	<description><![CDATA[<p>After playing around with the grid a little, it looks like the problem is that the grid is never getting the data and/or serializing it to JSON. I found an example where the data was added manually and it worked fine.</p>
</p>
<p>Thanks,</p>
<p>Jeremy</p>
]]></description>
        	        	<pubDate>Tue, 22 Feb 2011 04:07:37 +0200</pubDate>
        </item>
        <item>
        	<title>Jeremy A on Grid Rendering With No Data</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/grid-rendering-with-no-data#p22165</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/grid-rendering-with-no-data#p22165</guid>
        	        	<description><![CDATA[<p>Hello All,</p>
<p>I have created a grid using the documentation that comes with the download. I was able to get the grid working on my Mac dev environment, but when I moved the files to my Windows 7 dev environment the grid started rendering without data.</p>
</p>
<p>I can use the same PDO object that is passed to the grid to do a var_dump and see that the data is accessed. The section below will display data:</p>
<p>$test = $conn-&#62;query("SELECT VolunteerID, FirstName, LastName, PhoneNumber, Email FROM Volunteers");</p>
<p>$data = $test-&#62;fetchAll();</p>
<p>var_dump($data);</p>
</p>
<p>But it looks like the grid itself is having problems:</p>
</p>
<p>&#60;?php</p>
<p>require_once &#39;../Grid/jq-config.php&#39;;</p>
<p>// include the jqGrid Class</p>
<p>require_once "../Grid/php/jqGrid.php";</p>
<p>// include the PDO driver class</p>
<p>require_once "../Grid/php/jqGridPdo.php";</p>
<p>// Connection to the server</p>
<p>$conn = new PDO(DB_DSN,DB_USER,DB_PASSWORD);</p>
<p>// Tell the db that we use utf-8</p>
<p>$conn-&#62;query("SET NAMES utf8");</p>
</p>
<p>$selectCommand = "SELECT VolunteerID, FirstName, LastName, PhoneNumber, Email FROM Volunteers";</p>
</p>
<p>// Definition of the labels</p>
<p>$vLabels = array("VolunteerID"=&#62;"Id",</p>
<p>"FirstName" =&#62; "First Name",</p>
<p>"LastName" =&#62; "Last Name",</p>
<p>"PhoneNumber" =&#62; "Phone Number",</p>
<p>"Email" =&#62; "Email");</p>
</p>
<p>// Create the jqGrid instance</p>
<p>$grid = new jqGridRender($conn);</p>
<p>// Write the SQL Query</p>
<p>$grid-&#62;SelectCommand = $selectCommand;</p>
<p>// set the ouput format to json</p>
<p>$grid-&#62;dataType = "json";</p>
<p>// Let the grid create the model</p>
<p>$grid-&#62;setColModel(null, null, $vLabels);</p>
</p>
<p>// point to Fright column to use the function named MyFormatter</p>
<p>$grid-&#62;setColProperty("VolunteerID", array("formatter" =&#62; "js:volunteerIDFormatter"));</p>
</p>
<p>// Write the MyFormatter function</p>
<p>$myformat = &#60;&#60;&#60;FORMATVOLUNTEERID</p>
<p>function volunteerIDFormatter (cellValue, options, rowdata)</p>
<p>{</p>
<p>var path = "VolunteerEdit.php";</p>
<p>var qStr = "?VolunteerID=" + cellValue;</p>
<p>var cellHtml = "&#60;a href="" + path + qStr + ""&#62;edit&#60;/a&#62;";</p>
<p>return cellHtml;</p>
<p>}</p>
<p>FORMATVOLUNTEERID;</p>
</p>
<p>// Output the function with setJSCode</p>
<p>$grid-&#62;setJSCode($myformat);</p>
</p>
<p>// Set the url from where we obtain the data</p>
<p>$grid-&#62;setUrl(&#39;VolunteerListGrid.php&#39;);</p>
<p>// Set grid caption using the option caption</p>
</p>
<p>$grid-&#62;setGridOptions(array(</p>
<p>"caption"=&#62;"Volunteers",</p>
<p>"rowNum"=&#62;10,</p>
<p>"sortname"=&#62;"VolunteerID",</p>
<p>"hoverrows"=&#62;true,</p>
<p>"rowList"=&#62;array(10,20,50)</p>
<p>));</p>
</p>
<p>// Change some property of the field(s)</p>
<p>$grid-&#62;setColProperty("VolunteerID", array("label"=&#62;"ID", "width"=&#62;60));</p>
</p>
<p>// Enjoy</p>
<p>$grid-&#62;renderGrid(&#39;#grid&#39;,&#39;#pager&#39;,true, null, null, true,true);</p>
</p>
<p>$conn = null;</p>
<p>?&#62;</p>
</p>
<p>Any recommendations/help you guys can offer will be appreciated!</p>
</p>
<p>Thanks,</p>
<p>Jeremy</p></p>
]]></description>
        	        	<pubDate>Tue, 22 Feb 2011 02:12:33 +0200</pubDate>
        </item>
</channel>
</rss>