yii2-jstree
Widget for Yii Framework 2.0 to use JsTree, (*1)
, (*2)
Installation
The preferred way to install this extension is through composer., (*3)
Either run, (*4)
php composer.phar require --prefer-dist thiagotalma/yii2-jstree "~1.0.0"
or add, (*5)
"thiagotalma/yii2-jstree": "~1.0.0"
to the require section of your composer.json
file., (*6)
Usage
Once the extension is installed, simply use it in your code by :, (*7)
<?= \talma\widgets\JsTree::widget([
'attribute' => 'attribute_name',
'model' => $model,
'core' => [
'data' => $data
...
],
'plugins' => ['types', 'dnd', 'contextmenu', 'wholerow', 'state'],
...
]); ?>
Usage without a model (you must specify the "name" attribute) :, (*8)
<?= \talma\widgets\JsTree::widget([
'name' => 'js_tree',
'core' => [
'data' => $data
...
],
'plugins' => ['types', 'dnd', 'contextmenu', 'wholerow', 'state'],
...
]); ?>
If you wanna use the contextmenu plugin and you are having issues with a not appearing menu, you should add the following css to your site:, (*9)
.vakata-context {
z-index:999 !important;
}