Here is the filed issue:
http://zendframework.com/issues/browse/ZF-9731

Le 21/04/10 22:34, Matthew Weier O'Phinney a écrit :
-- Guillaume ORIOL<go.li...@technema.fr>  wrote
(on Wednesday, 21 April 2010, 10:22 PM +0200):
You are right, but the example you take is not the Json I get from 
$paginator->toJson().
It is the Json required by JsonRestStore.
Is there something I misunderstand?

I was saying that we need an issue filed so that $paginator->toJson()
returns the correct output -- which should be an array of objects, not
an object of objects.

Look at your example:

     [
         {"prop1":"value1","prop2":"value2", ...},
         {"prop1":"value1","prop2":"value2", ...}
     ]

That's an array of objects. :)

And yes, it will work for JsonRestStore -- I've used such formats
myself.

-- Guillaume ORIOL<go.li...@technema.fr>   wrote
(on Wednesday, 21 April 2010, 04:08 PM +0200):
As far as I know, dojox.data.JsonRestStore expects to receive
data in the form:
[
{"prop1":"value1", "prop2":"value2", ...},
{"prop1":"value1", "prop2":"value2", ...},
...
]

On the server side, I fetch data with a paginator
(Zend_Paginator_Adapter_DbSelect). This paginator implements a
toJson function. But whatever FETCH_MODE is used to get the data, I
get a Json representation like this one:
{
"0": {"prop1":"value1", "prop2":"value2", ...},
"1": {"prop1":"value1", "prop2":"value2", ...},
...
}

Is there something obvious I miss or do I have to write my own
implementation of the toJson() function?

Honestly, I'd consider that a bug -- numeric indices should be
returned
as an array, not as an object. Can you file an issue, please?

--
Matthew Weier O'Phinney
Project Lead            | matt...@zend.com
Zend Framework          | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc


Reply via email to