2017 © Pedro Peláez
 

yii2-extension yii2-nestable

Yii 2.0 implementation of nested set behavior using jquery.nestable plugin.

image

slatiusa/yii2-nestable

Yii 2.0 implementation of nested set behavior using jquery.nestable plugin.

  • Saturday, October 8, 2016
  • by slatiusa
  • Repository
  • 3 Watchers
  • 17 Stars
  • 2,297 Installations
  • JavaScript
  • 5 Dependents
  • 0 Suggesters
  • 12 Forks
  • 1 Open issues
  • 8 Versions
  • 5 % Grown

The README.md

yii2-nestable

Yii 2.0 implementation of nested set behavior using jquery.nestable plugin. - jquery.nestable plugin: http://dbushell.github.io/Nestable/ - Nested Sets Behavior for Yii 2: https://github.com/creocoder/yii2-nested-sets, (*1)

Installation

The preferred way to install this extension is through composer., (*2)

Either run, (*3)

$ php composer.phar require slatiusa/yii2-nestable "dev-master"

or add, (*4)

"slatiusa/yii2-nestable": "dev-master"

to the require section of your composer.json file., (*5)

Usage

Make sure you've attached the NestedSetsBehavior (creocoder/yii2-nested-sets) correctly to your model. Then add the node move handler to you controller by attaching the supplied action;, (*6)

use slatiusa\nestable\Nestable;

class yourClass extends Controller
{
    public function actions() {
        return [
            'nodeMove' => [
                'class' => 'slatiusa\nestable\NodeMoveAction',
                'modelName' => TreeModel::className(),
            ],
        ];
    }

And then render the widget in your view;, (*7)

echo Nestable::widget([
    'type' => Nestable::TYPE_WITH_HANDLE,
    'query' => TreeModel::find()->where([ top of tree ]),
    'modelOptions' => [
        'name' => 'name'
    ],
    'pluginEvents' => [
        'change' => 'function(e) {}',
    ],
    'pluginOptions' => [
        'maxDepth' => 7,
    ],
]);

You can either supply an ActiveQuery object in query from which a tree will be built. You can also supply an item list;, (*8)

    ...
    'items' => [
        ['content' => 'Item # 1', 'id' => 1],
        ['content' => 'Item # 2', 'id' => 2],
        ['content' => 'Item # 3', 'id' => 3],
        ['content' => 'Item # 4 with children', 'id' => 4, 'children' => [
            ['content' => 'Item # 4.1', 'id' => 5],
            ['content' => 'Item # 4.2', 'id' => 6],
            ['content' => 'Item # 4.3', 'id' => 7],
        ]],
    ],

The modelOptions['name'] should hold an attribute name that will be used to name on the items in the list. You can alternatively supply an unnamed function($model) to build your own content string., (*9)

Supply a pluginEvents['change'] with some JavaScript code to catch the change event fired by jquery.nestable plugin. The pluginOptions accepts all the options for the original jquery.nestable plugin., (*10)

The Versions

08/10 2016

dev-master

9999999-dev https://github.com/Hommer101/yii2-nestable

Yii 2.0 implementation of nested set behavior using jquery.nestable plugin.

  Sources   Download

BSD 3-Clause

The Requires

 

by Arno Slatius

extension yii2 jquery nested set widget behavior sortable nestable

08/10 2016

v1.2.1

1.2.1.0 https://github.com/Hommer101/yii2-nestable

Yii 2.0 implementation of nested set behavior using jquery.nestable plugin.

  Sources   Download

BSD 3-Clause

The Requires

 

by Arno Slatius

extension yii2 jquery nested set widget behavior sortable nestable

24/01 2016

v1.2.0

1.2.0.0 https://github.com/Hommer101/yii2-nestable

Yii 2.0 implementation of nested set behavior using jquery.nestable plugin.

  Sources   Download

BSD 3-Clause

The Requires

 

by Arno Slatius

extension yii2 jquery nested set widget behavior sortable nestable

22/06 2015

v1.1.0

1.1.0.0 https://github.com/Hommer101/yii2-nestable

Yii 2.0 implementation of nested set behavior using jquery.nestable plugin.

  Sources   Download

BSD 3-Clause

The Requires

 

by Arno Slatius

extension yii2 jquery nested set widget behavior sortable nestable

22/06 2015

dev-AllowMoveToRoot

dev-AllowMoveToRoot https://github.com/Hommer101/yii2-nestable

Yii 2.0 implementation of nested set behavior using jquery.nestable plugin.

  Sources   Download

BSD 3-Clause

The Requires

 

by Arno Slatius

extension yii2 jquery nested set widget behavior sortable nestable

28/04 2015

1.0.0.x-dev

1.0.0.9999999-dev https://github.com/Hommer101/yii2-nestable

Yii 2.0 implementation of nested set behavior using jquery.nestable plugin.

  Sources   Download

BSD 3-Clause

The Requires

 

by Arno Slatius

extension yii2 jquery nested set widget behavior sortable nestable

28/04 2015

v1.0.0

1.0.0.0 https://github.com/Hommer101/yii2-nestable

Yii 2.0 implementation of nested set behavior using jquery.nestable plugin.

  Sources   Download

BSD 3-Clause

The Requires

 

by Arno Slatius

extension yii2 jquery nested set widget behavior sortable nestable

28/04 2015

v1.0.0.x-dev

1.0.0.9999999-dev https://github.com/Hommer101/yii2-nestable

Yii 2.0 implementation of nested set behavior using jquery.nestable plugin.

  Sources   Download

BSD 3-Clause

The Requires

 

by Arno Slatius

extension yii2 jquery nested set widget behavior sortable nestable