iutbay/yii2-jstree

此包最新版本(v0.1)没有可用的许可信息。

Yii2 的 JsTree

安装: 395

依赖者: 0

建议者: 0

安全: 0

星标: 2

关注者: 2

分支: 0

开放问题: 0

类型:yii2-extension

v0.1 2014-12-28 21:04 UTC

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
		],
	],
]) ?>