iutbay / yii2-jstree
此包最新版本(v0.1)没有可用的许可信息。
Yii2 的 JsTree
v0.1
2014-12-28 21:04 UTC
Requires
- bower-asset/jstree: *
- iutbay/yii2-fontawesome: dev-master
This package is not auto-updated.
Last update: 2024-09-24 02:57:48 UTC
README
JsTree for Yii2.
工作进行中...
安装
推荐通过 composer 安装此辅助工具。
运行以下命令之一
php composer.phar require "iutbay/yii2-jstree" "*"
或在您的应用程序的 composer.json
文件的 require 部分添加
"iutbay/yii2-jstree" : "*"
到
https://packagist.org.cn/packages/iutbay/yii2-jstree
用法
与模型和 ActiveForm 一起使用
<?= $form->field($model, 'test')->widget(\iutbay\yii2jstree\JsTree::className(), [ 'items' => [ [ 'id' => 1, 'text' => 'Test 1', 'children' => [ [ 'id' => 2, 'text' => 'Test 2', ], ], ], [ 'id' => 3, 'text' => 'Test 3', 'icon' => 'fa fa-file', // font awesome icon ], ], ]) ?>
不使用模型
<?= \iutbay\yii2jstree\JsTree::widget([ 'name' => 'test', 'value' => '1,2', 'items' => [ [ 'id' => 1, 'text' => 'Test 1', 'children' => [ [ 'id' => 2, 'text' => 'Test 2', ], ], ], [ 'id' => 3, 'text' => 'Test 3', 'icon' => 'fa fa-file', // font awesome icon ], ], ]) ?>