Forum
Topic RSS
02:12
22/02/2011
OfflineHello All,
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.
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:
$test = $conn->query("SELECT VolunteerID, FirstName, LastName, PhoneNumber, Email FROM Volunteers");
$data = $test->fetchAll();
var_dump($data);
But it looks like the grid itself is having problems:
<?php
require_once '../Grid/jq-config.php';
// include the jqGrid Class
require_once "../Grid/php/jqGrid.php";
// include the PDO driver class
require_once "../Grid/php/jqGridPdo.php";
// Connection to the server
$conn = new PDO(DB_DSN,DB_USER,DB_PASSWORD);
// Tell the db that we use utf-8
$conn->query("SET NAMES utf8");
$selectCommand = "SELECT VolunteerID, FirstName, LastName, PhoneNumber, Email FROM Volunteers";
// Definition of the labels
$vLabels = array("VolunteerID"=>"Id",
"FirstName" => "First Name",
"LastName" => "Last Name",
"PhoneNumber" => "Phone Number",
"Email" => "Email");
// Create the jqGrid instance
$grid = new jqGridRender($conn);
// Write the SQL Query
$grid->SelectCommand = $selectCommand;
// set the ouput format to json
$grid->dataType = "json";
// Let the grid create the model
$grid->setColModel(null, null, $vLabels);
// point to Fright column to use the function named MyFormatter
$grid->setColProperty("VolunteerID", array("formatter" => "js:volunteerIDFormatter"));
// Write the MyFormatter function
$myformat = <<<FORMATVOLUNTEERID
function volunteerIDFormatter (cellValue, options, rowdata)
{
var path = "VolunteerEdit.php";
var qStr = "?VolunteerID=" + cellValue;
var cellHtml = "<a href="" + path + qStr + "">edit</a>";
return cellHtml;
}
FORMATVOLUNTEERID;
// Output the function with setJSCode
$grid->setJSCode($myformat);
// Set the url from where we obtain the data
$grid->setUrl('VolunteerListGrid.php');
// Set grid caption using the option caption
$grid->setGridOptions(array(
"caption"=>"Volunteers",
"rowNum"=>10,
"sortname"=>"VolunteerID",
"hoverrows"=>true,
"rowList"=>array(10,20,50)
));
// Change some property of the field(s)
$grid->setColProperty("VolunteerID", array("label"=>"ID", "width"=>60));
// Enjoy
$grid->renderGrid('#grid','#pager',true, null, null, true,true);
$conn = null;
?>
Any recommendations/help you guys can offer will be appreciated!
Thanks,
Jeremy
06:02
Moderators
30/10/2007
OfflineHello,
It seems you use the commertial PHP jqGrid component.
Please post your question here.
Also there is a forum topic regarding this problem.
Kind Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
Most Users Ever Online: 994
Currently Online:
13 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66
Log In
Home