2017 © Pedro Peláez
 

yii2-extension jstree

Yii2 extension js tree

image

johnnylei/jstree

Yii2 extension js tree

  • Friday, June 16, 2017
  • by johnnylei
  • Repository
  • 2 Watchers
  • 2 Stars
  • 122 Installations
  • JavaScript
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 15 % Grown

The README.md

yii extension js tree

install, (*1)

composer require --prefer-dist johnnylei/jstree

jstree相关配置参照官方文档https://www.jstree.com/, (*2)

直接使用, (*3)

<?= \common\widgets\jsTree\JsTree::widget([
    'options'=>[
        'core' => [
            'data' => [
                "text" => "Root node",
                "children" => [
                    [
                        "text" => "Child node 1",
                        "data"=>"name1",
                    ],
                    [
                        "text" => "Child node 2",
                        'data'=>'name2'
                    ],
                    [
                        "text" => "Child node 3",
                        'data'=>'name3',
                    ],
                ]
            ]
        ]
    ],
])?>

使用在active form里面, (*4)

<?= $form->field($model, 'content')->widget(ActiveFormJsTree::className(), [
    'options'=>[
        'core' => [
            'data' => [
                "text" => "Root node",
                "children" => [
                    [
                        "text" => "Child node 1",
                        "data"=>"name1",
                    ],
                    [
                        "text" => "Child node 2",
                        'data'=>'name2'
                    ],
                    [
                        "text" => "Child node 3",
                        'data'=>'name3',
                    ],
                ]
            ]
        ]
    ],
])?>

在form表单里面使用, (*5)

<?= FormJsTree::widget([
    'inputOptions'=>[
        'class' => 'form-control',
        'style'=>[
            'display'=>'none',
        ],
        'name'=>'MoveForm[parent]',
        'value'=>$parent,
    ],
    'options'=>[
        'core' => [
            'data' => [
                "text" => "Root node",
                "children" => [
                    [
                        "text" => "Child node 1",
                        "data"=>"name1",
                    ],
                    [
                        "text" => "Child node 2",
                        'data'=>'name2'
                    ],
                    [
                        "text" => "Child node 3",
                        'data'=>'name3',
                    ],
                ]
            ],
        ]
    ],
]);?>

The Versions

16/06 2017

dev-master

9999999-dev https://github.com/johnnylei/yii2-jsTree.git

Yii2 extension js tree

  Sources   Download

MIT

The Requires

 

by johnny Lei

yii2 tree

16/06 2017

1.1

1.1.0.0 https://github.com/johnnylei/yii2-jsTree.git

Yii2 extension js tree

  Sources   Download

MIT

The Requires

 

by johnny Lei

yii2 tree

16/06 2017

1.0

1.0.0.0 https://github.com/johnnylei/yii2-jsTree.git

Yii2 extension js tree

  Sources   Download

MIT

The Requires

 

by johnny Lei

yii2 tree