yii2mod/yii2-tree Tree widget based on Fancytree plugin.

treetreewidget

993323

Yii2 Tree Widget


Tree widget based on Fancytree extension http://wwwendt.de/tech/fancytree/demo/#sample-default.html

Latest Stable Version Total Downloads License Build Status

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist yii2mod/yii2-tree "*"

or add

"yii2mod/yii2-tree": "*"

to the require section of your composer.json.

Usage

Once the extension is installed, simply add widget to your page as follows:

<?php echo yii2mod\tree\Tree::widget([
            'items' => [
                ['title' => 'Category 1'],
                ['title' => 'Category 2'],
                [
                    'title' => 'Category 3',
                    'children' => [
                        [
                            'title' => 'Category 3.1',
                        ],
                        [
                            'title' => 'Category 3.2',
                            'children' => [
                                [
                                    'title' => 'Category 3.2.1',
                                ]
                            ],
                            'folder' => true,
                        ],
                    ],
                    'folder' => true,
                ],

            ],
            'clientOptions' => [
                'autoCollapse' => true,
                'clickFolderMode' => 3,
                'activate' => new \yii\web\JsExpression('
                        function(node, data) {
                              node  = data.node;
                              // Log node title
                              console.log(node.title);
                        }
                '),
            ],
        ]); ?>

You can also change the theme of Fancytree extension!

To change the theme, you can configure the assetManager array in your application configuration:

// skin-win8

'assetManager' => [
    'bundles' => [
        'yii2mod\tree\TreeAsset' => [
            'css' => [
                'skin-win8/ui.fancytree.less',
            ]
        ],
    ],
]

Statistics

Downloads
GitHub Stars
GitHub Forks

Releases

  • 1.3.121 March 2017
  • 1.328 January 2017
  • 1.231 December 2016
  • 1.116 December 2016
  • 117 June 2015

Comments



1.3.1 is the latest of 5 releases



MIT license
Stats
14 github stars & 2 github forks
2 downloads in the last day
321 downloads in the last 30 days
2049 total downloads