jqgrid中的空网格
我正在尝试将网格集成到我的 PHP 项目中,JQgrid 看起来很简单! 当我集成时,我只能看到网格,而看不到网格中的数据! 我刚刚更改了示例代码的数据库设置以使用我的数据库。
调试结果:
当我使用 firebug 进行调试时,我能够在 firebug 的 consolde 模式下看到 db 行。
这里还粘贴了 jqGrid.log 的日志
它还会抛出警告消息“警告:date()[function.date]:它是依赖系统的时区设置是不安全的,您需要使用 date.timezone 设置或 date_default_timezone_set() 函数,如果您使用了这些方法中的任何一个,但仍然收到此警告,您很可能拼错了时区标识符。我们在 C:\Users\Karthik\Desktop\apache\htdocs\php\jqGrid.php(1) 中选择了“-5.0/no DST”,即“America/New_York”: eval()第 1 行的代码”
这两个文件都位于根目录中。解决
PHP 代码“myfristgrid.php”
require_once 'jq-config.php' 的一些线索;
// 包含 jqGrid 类
require_once "php/jqGrid.php";
require_once "php/jqGridPdo.php";
$conn = 新的 PDO(DB_DSN,DB_USER,DB_PASSWORD);
$conn->query("设置名称 utf8");
$grid = new jqGridRender($conn);
$grid->debug = true;
$grid->SelectCommand = '从问题中选择*';
$grid->datatype = 'json';
$grid->setColModel();
$grid->setUrl('myfirstgrid.php');
$grid->setGridOptions(数组( "caption"=>"这是自定义标题", “行数”=>10, "排序名称"=>"id", “悬停行”=>真, "rowList"=>数组(10,20,50), ));
$grid->setColProperty("id", array("label"=>"ID", "width"=>60));
// 享受
$grid->renderGrid('#grid','#pager',true, null, null, true,true);
$conn = null;
jqGrid.log
执行了 2 个查询 - 2011-01-26 22:50:28 大批 ( [0] =>大批 ( [时间] => 2011-01-26 22:50:28 [查询] => SELECT COUNT(*) AS COUNT FROM 问题 [数据] => [类型] => [字段] => [主要] => [输入] => )
[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] =>
)
)
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\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] =>
)
)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您无法在jqGrid中正确使用setColProperty。
You can't properly use setColProperty in the jqGrid.