Hi Matthew,
Not totally sure what you mean by "$testArr is a single item" - it's an
array, surely, in the same way that array($testArr) is an array? It's just
an assoc. array rather than a simple array (if that's the right term -
simple array?)
In any event, it's actually worse than that - although Zend_Dojo_Data will
accept array($testArr) as you've outlined, it is no use for the Tree widget.
Each of *children* needs to be a simple array also - when you view the JSON
string, there are no [square brackets] around the items in children, so they
are not treated as a JS array and Tree fails.
I feel there ought to be a way to make Zend_Dojo_Data handle this sensibly,
but am not sure what it might look like (or, after your comments, if it is
even desirable).
Yours,
Mark
Matthew Weier O'Phinney-3 wrote:
>
>
>
> dojo.data expects a format like the following:
>
> {
> identifier: "name",
> items: []
> }
>
> The "items" parameter needs to be an array of items. Each item in that
> array should be an associative array. In your example below, $testArr is
> a *single* item to send. You would then provide it to Zend_Dojo_Data as
> this:
>
> $data = new Zend_Dojo_Data('id', array($testArr), 'description');
>
>
>
--
View this message in context:
http://www.nabble.com/RFC%3A-Zend_Dojo_Data---associative-arrays-tp23175415p23193957.html
Sent from the Zend Framework mailing list archive at Nabble.com.