user2132954
user2132954

Reputation: 31

how to integrate jGrid into Zend 1?

I am facing a problem where in my Zend project I need to display some DB data on an interface. I picked jGrid (jQuery) as the one that can do subgrids and even new grids as a subgrids.

I googled for "Zend + jgrid" and finished with downloading ZendX, extension for Zend, and putting it in /library.

I also added entries to application.ini:

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

then in layout I added: echo $this->jQuery();

and finally in the view i put:

$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);

following use case UC-1 from this link What I got it was an error report:

Fatal error: Call to a member function jgrid() on a non-object in D:\PROJEKTY\wtms_gui\application\views\scripts\jgrid\index.phtml on line 28

which refers to the code line:

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

What am I missing and how to run simple table with jGrid where data is taken from an array?

best regards

Upvotes: 0

Views: 60

Answers (1)

Tim Fountain
Tim Fountain

Reputation: 33148

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

Upvotes: 1

Related Questions