Further to this, if you specify "leaf" => true, Ext JS disables the
node from having any children, so you can't drop anything onto it. If
you want it to be already expanded, but still allow children, then you
can use this code.

foreach ($nodes as $node){
        if ($node['Employee']['has_children']){
                $data[] = array("text" => $node['Employee']['name'], "id" =>
$node['Employee']['id'], "cls" => "folder");
        } else {
                $data[] = array("text" => $node['Employee']['name'], "id" =>
$node['Employee']['id'], "cls" => "file", "children" => array(),
"expanded" => true);
        }
}

But you would still need to populate the "has_children" field in the
database somehow.

Cheers,
Adam



On Feb 14, 11:18 am, Adam Royle <[EMAIL PROTECTED]> wrote:
> Hi Mech7,
>
> Thanks for taking the time to do the tutorial. The ajax layout is
> selected automatically if you include the "RequestHandler" component
> in your controller (which is demonstrated in the tutorial).
>
> The issue with the your responseText problem is most likely due to you
> outputting data (or whitespace) before the exit() command. Check the
> top of your php files for any whitespace and remove them.
>
> I agree with your comment about the "+" symbol being awkward, however
> this is more of an Ext JS config issue than a cakephp issue. You can
> set "leaf" => true in the node array in getnodes.ctp to configure this
> - however you'll still need to consider either dynamically finding out
> this information or storing the leaf setting in the database upon
> save.
>
> Cheers,
> Adam
>
> On Feb 14, 4:16 am, Mech7 <[EMAIL PROTECTED]> wrote:
>
> > Ok i got it to work.. there a small changes i needed to make though..
> > on getnodes function the layout was not set:
> > $this->layout = 'ajax';
>
> > In the javascript from ext, 1 was never send back as the first
> > character at 0 but at 1.. so there was always an alert that the
> > article could not be saved (in FF 3 b3 atleast)
>
> > if (response.responseText.charAt(0) != 1){
>
> > To
>
> > if (response.responseText.charAt(1) != 1){
>
> > Also there are some things in the interface that could be akward to
> > the user.. like the + symbol on a node that contains no childeren.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to