Hello Pawel,

cool that you used ZendX_JQuery as basis :-)

The problem is described very simple. Zend_Json cannot handle javascript 
expressions. Its escaping everything like it were a string. Sadly the 
Zend_Json_Expr proposal didn't make it into the 1.7 release.

To fix this you have to hack your Zend_Json output with preg_replace somehow to 
strip the " around the pager: value.

greetings,
Benjamin

On Friday 14 November 2008 16:35:46 Paweł Chuchmała wrote:
> Hi.
>
> I want to use jqGrid with ZF, so I wrote simple helper based on
> ZendX_JQuery helpers.
> I have a problem with some params.
>
> As result I must have:
>     jQuery("#list2").jqGrid({
>         url: '/artist/list/format/json/',
>         datatype: 'json',
>         viewrecords: true,
> *        pager: jQuery('#pager2'),*
>         rowNum:20,
>         rowList:[10,20,30],
>         imgpath: "/css/themes/sand/images",
>         sortname: 'id',
>         colNames: ['Id', 'Nazwa'],
>         colModel: [
>                    {name: 'artist_id', index:'artist_id', width:55},
>                    {name: 'artist_name', index:'artist_name', width:300}
>
>         ],
>     });
>
>
> so I make array with this options.
> $params = array(
>    ...
>    'pager' => "jquery('#pager2')",
>    ...
> );
> After Zend_Json::encode($myarray) i have:
> ...
> "pager": "jquery('#pager2')"
> ...
>
> from jqGridDocumentation: pager defines that we want to use a pager bar to
> navigate through the records. This must be a valid html element;
> In my example it's a string.
>
> What is the best solution for this?
>
> regards,

-- 
Benjamin Eberlei
http://www.beberlei.de

Reply via email to