/yii2-jqTree

alternative JS tree for yii2 framework, with drug-n-drop

Primary LanguageJavaScript

jqTree.js widget for Yii2

Renders a jqTree.js plugin widget.

Installation

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.

Usage

<?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