2008年9月29日星期一

Re: [fw-mvc] dijit.Tree

>
> Probably most importantly, you can use Zend_Dojo_Data to provide a
> dojo.data store for use with dijit.Tree. This will simplify feeding the
> tree with data.
>
I was already playing with this - Although I came across an error I
haven't yet looked into fully.

I have the following error: 'Only arrays and objects may be attached'

The data I am trying to use is like:

Array
(
[id] => 1
[name] => Millenium Group
[costcentre] => Array
(
[0] => Array
(
[id] => 2
[name] => Millenium Internal
[costcentre] => Array
(
......
)
.....
.....

And the client code is:

$t = new TreeVisitor();
$tree = $model->accept($t);
$data = new Zend_Dojo_Data('id', $tree);

Any ideas? I am passing an Array.

> Second, and more difficult, you can take a look at
> Zend_Dojo_View_Helper_Dijit to see how to extend it to create a
> re-usable helper for tree dijits. If you do, please be kind and
> contribute back the solution to us, so we can offer it in an upcoming
> release of ZF. :)
Already working on it! If what I end up with is worth contributing, I
will be sure to do so.

Thanks Matthew,

Daniel

Matthew Weier O'Phinney wrote:
> -- Daniel Skinner <skinner@destiny-denied.co.uk> wrote
> (on Monday, 29 September 2008, 02:27 PM +0100):
>
>> I would like to create a dijit.Tree element in Zend MVC. What's the best
>> way forward? Can Zend_Dojo_View_Helper_Dijit help?
>>
>
> Probably most importantly, you can use Zend_Dojo_Data to provide a
> dojo.data store for use with dijit.Tree. This will simplify feeding the
> tree with data.
>
> As for the element itself, you have a couple of options. First, you can
> use declarative markup within your view scripts:
>
> <?
> Zend_Dojo_View_Helper_Dojo::setUseDeclarative(true);
> $this->dojo()->requireModule('dijit.Tree');
> ?>
> <div dojoType="dijit.Tree" ...>...</div>
>
> This is the simplest way to achieve this functionality.
>
> Second, and more difficult, you can take a look at
> Zend_Dojo_View_Helper_Dijit to see how to extend it to create a
> re-usable helper for tree dijits. If you do, please be kind and
> contribute back the solution to us, so we can offer it in an upcoming
> release of ZF. :)
>
>

没有评论: