Forum

July 12th, 2025
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
Grid Rendering With No Data
22/02/2011
02:12
Avatar
Jeremy A
New Member
Members
Forum Posts: 2
Member Since:
22/02/2011
sp_UserOfflineSmall Offline

Hello 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

22/02/2011
04:07
Avatar
Jeremy A
New Member
Members
Forum Posts: 2
Member Since:
22/02/2011
sp_UserOfflineSmall Offline

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.

Thanks,

Jeremy

22/02/2011
06:02
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

It seems you use the commertial PHP jqGrid component.

Please post your question here.

http://www.trirand.net/forum/

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.

Forum Timezone: Europe/Sofia

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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information