0

我面临一个问题,在我的 Zend 项目中,我需要在界面上显示一些数据库数据。我选择 jGrid (jQuery) 作为子网格,甚至新网格作为子网格。

我用谷歌搜索“Zend + jgrid”并完成下载 ZendX,Zend 的扩展,并将其放入 /library。

我还在 application.ini 中添加了条目:

autoloadernamespaces[] = "ZendX" 
resources.view.helperPath.ZendX_JQuery_View_Helper = "ZendX/JQuery/View/Helper"
pluginPaths.ZendX_Application_Resource = "ZendX/Application/Resource"

然后在布局中添加: echo $this->jQuery();

最后在我看来:

$options = array(
    "colModel" => array(
        array(
            "name"   => "Inv No",
            "id"     => "id",
            "index"  => "id",
            "width"  => 75,
            "align"  => "center"
            ),
        array(
            "name"   => "Date",
            "id"     => "invdate",
            "index"  => "invdate"
        ),             
        array(
            "name"   => "Client",
            "id"     => "name",
            "index"  => "name"
        ),
    ),
    "rowNum"    => 10,
    "autowidth" => "true",
    "rowList"   => array(10, 20, 30),
    "sortorder" => "desc",
    "caption"   => "Example"
);
$this->_helper->jgrid($options);

以下来自此链接的用例 UC-1 我得到的是错误报告:

致命错误:在第 28 行对 D:\PROJEKTY\wtms_gui\application\views\scripts\jgrid\index.phtml 中的非对象调用成员函数 jgrid()

这是指代码行:

$this->_helper->jgrid($options);

我缺少什么以及如何使用 jGrid 运行从数组中获取数据的简单表?

此致

4

1 回答 1

1

The page you linked to is a proposal for a component, it doesn't look like it ever got past the proposal stage. There is no jGrid component in Zend Framework.

On the off chance you've downloaded a third party implementation, $this->_helper->jgrid($options); would be how you'd call a 'jgrid' action helper from a controller, so that line would only work inside a controller action. To call a view helper from within a view the syntax would be $this->jgrid($options).

于 2013-03-05T11:37:52.883 回答