Yii Framework Forum: CTreeView widget is looking and behaving strange - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

CTreeView widget is looking and behaving strange Rate Topic: -----

#1 User is offline   rabol 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 50
  • Joined: 08-October 08

Posted 13 October 2008 - 03:34 AM

I'm working my way through Yii and found that the CTreeView is behaving a little strange

Setup: latest SVN Yii, Yiic created web application
I have added a new action to SiteController like this:

public function actionTest()
{
    $tdata =    array
                (
                    array
                    (
                        'text'            => 'Node 1',
                        'expanded'        => false,
                    ),
                    array
                    (
                        'text'            => 'Node 2',
                        'expanded'        => false,
                        'children'        =>    array
                                            (
                                                'text'            => 'Node 2.1',
                                            ),
                    ),
                );

    $this->render('test',array('tdata' => $tdata));
}


the view file looks like this:


<h1>Tree Test</h1>
<?php
$this->widget('CTreeView',array('data' => $tdata));
?>



Issues:

1) The image for the first node looks like it's a 'between' 2 nodes image.
2) The sub node is not displayed correctly

I hope that I'm doing something wrong, so please let me know what.

Br
Steen


0

#2 User is offline   rabol 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 50
  • Joined: 08-October 08

Posted 13 October 2008 - 04:23 AM

Issue 2 is due to the fact that children should be an array of children - My mistake.
0

#3 User is offline   qiang 

  • Yii Project Lead
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,899
  • Joined: 04-October 08
  • Location:DC, USA

Posted 13 October 2008 - 06:04 AM

It looks fine using the yiic webapp. Maybe it's because of your CSS?
0

#4 User is offline   rabol 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 50
  • Joined: 08-October 08

Posted 13 October 2008 - 06:19 AM

I use the CSS created by Yiic webapp.

Take a look at the picture I have attached (I have made a red square), then you will see that it looks like the 'tree' is not started correctly - No 'root'

Attached File(s)


0

#5 User is offline   qiang 

  • Yii Project Lead
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,899
  • Joined: 04-October 08
  • Location:DC, USA

Posted 13 October 2008 - 06:36 AM

That's the expected behavior. Check this: http://jquery.bassis.../treeview/demo/
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users