Renders a jqTree.js plugin widget.
The preferred way to install this extension is through composer.
Either run
php composer.phar require forecho/yii2-jqtree "*"
or add
"forecho/yii2-jqtree" : "*"
to the require section of your application's composer.json
file.
<?php
use forecho\jqtree\JQTree;
$dataTree = [
[
'label' => 'node1',
'children' => array(
['label' => 'child1'],
['label' => 'child2'],
),
],
['label' => 'node2'],
];
echo JQTree::widget([
'id' => 'treeview',
'data' => $dataTree,
'dragAndDrop' => true,
'selectable' => true,
'saveState' => true,
'autoOpen' => true,
'htmlOptions' => ['class' => 'treeview-red']
]) ?>
Get√Yii Web development has never been so fun! www.getyii.com