Yii 2.0: yii2-widget-bootstraptreeview

Bootstrap Tree View widget wrapper for yii2
4 followers

Bootstrap Tree View widget wrapper for yii2

Wrapper home page Widget home page

Installation

The preferred way to install this extension is through composer.

Install

Either run

$ php composer.phar require execut/yii2-widget-bootstraptreeview "dev-master"

or add

"execut/yii2-widget-bootstraptreeview": "dev-master"

to the require section of your composer.json file.

Usage

use execut\widget\TreeView;
 
$items = [
    [
        'text' => 'Parent 1',
        'nodes' => [
            [
                'text' => 'Child 1',
                'nodes' => [
                    [
                       'text' => 'Grandchild 1'
                    ],
                    [
                       'text' => 'Grandchild 2'
                    ]
                ]
            ],
            [
                'text' => 'Child 2',
            ]
        ],
    ],
    [
        'text' => 'Parent 2',
    ]
];
 
$onSelect = new \yii\web\JsExpression(<<<JS
function (undefined, item) {
    $.pjax({
        container: '#pjax-container',
        url: item.href,
        timeout: null
    });
}
JS
);
$groupsContent = TreeView::widget([
    'data' => $data,
    'size' => TreeView::SIZE_SMALL,
    'clientOptions' => [
        'onNodeSelected' => $onSelect,
        'selectedBackColor' => 'rgb(40, 153, 57)',
        'borderColor' => '#fff',
    ],
]);

License

yii2-widget-bootstraptreeview is released under the Apache License Version 2.0. See the bundled LICENSE.md for details.

Total 2 comments

#19819 report it
eXeCUT at 2016/03/31 02:25am
Uncaught TypeError: jQuery(...).TreeFilterInput is not a function

Rare, You install composer plugin for bower packages https://github.com/francoispluchino/composer-asset-plugin ?

#19815 report it
exru at 2016/03/28 08:23am
Rare

Uncaught TypeError: jQuery(...).TreeFilterInput is not a function

Leave a comment

Please to leave your comment.

Create extension
Downloads
No downloadable files yet