I am trying to integrate a grid to my PHP project, JQgrid looked so easy!! When i Integrated I was only able to see the grid, not the data in the grid! I have just change the db settings of the sample code to work with my DB.
Debug results:
When I debugged with firebug I am able to see the db rows in the consolde mode of firebug.
Here with also pasting the logs of jqGrid.log
It also throws a warning msg "Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for '-5.0/no DST' instead in C:\Users\Karthik\Desktop\apache\htdocs\开发者_C百科php\jqGrid.php(1) : eval()'d code on line 1"
Both files resides in root directory. Some clues to troubleshoot
PHP Code"myfristgrid.php"
require_once 'jq-config.php';
// include the jqGrid Class
require_once "php/jqGrid.php";
require_once "php/jqGridPdo.php";
$conn = new PDO(DB_DSN,DB_USER,DB_PASSWORD);
$conn->query("SET NAMES utf8");
$grid = new jqGridRender($conn);
$grid->debug = true;
$grid->SelectCommand = 'SELECT * FROM question';
$grid->datatype = 'json';
$grid->setColModel();
$grid->setUrl('myfirstgrid.php');
$grid->setGridOptions(array( "caption"=>"This is custom Caption", "rowNum"=>10, "sortname"=>"id", "hoverrows"=>true, "rowList"=>array(10,20,50), ));
$grid->setColProperty("id", array("label"=>"ID", "width"=>60));
// Enjoy
$grid->renderGrid('#grid','#pager',true, null, null, true,true);
$conn = null;
jqGrid.log
Executed 2 query(s) - 2011-01-26 22:50:28 Array ( [0] => Array ( [time] => 2011-01-26 22:50:28 [query] => SELECT COUNT(*) AS COUNT FROM question [data] => [types] => [fields] => [primary] => [input] => )
[1] => Array
(
[time] => 2011-01-26 22:50:28
[query] => SELECT * FROM question ORDER BY id asc LIMIT 0, 10
[data] =>
[types] =>
[fields] =>
[primary] =>
[input] =>
)
)
You can't properly use setColProperty in the jqGrid.
精彩评论