toir427/yii2-nestable

Yii2 Nestable

Installs: 91

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 2

Type:yii2-extension

dev-master 2021-04-01 13:09 UTC

This package is auto-updated.

Last update: 2024-04-06 19:49:32 UTC


README

Yii2 Nestable

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist toir427/yii2-nestable "*"

or add

"toir427/yii2-nestable": "*"

to the require section of your composer.json file.

Screenshot

nestable.png

Usage

Basic nestables :

<?php use toir427\nestable\Nestable; ?>
<?= Nestable::widget([
               'items' => [
                   [
                       'id'      => 1,
                       'content' => 'Item # 1',
                   ],
                   [
                       'id'      => 2,
                       'content' => 'Item # 2',
                   ],
                   [
                       'id'      => 3,
                       'content' => 'Item # 3',
                   ],
                   [
                       'content'  => 'Item # 4 with children',
                       'id'       => 4,
                       'children' => [
                           [
                               'id'      => 5,
                               'content' => 'Item # 4.1',
                           ],
                           [
                               'id'      => 6,
                               'content' => 'Item # 4.2',
                           ],
                           [
                               'id'      => 7,
                               'content' => 'Item # 4.3',
                           ],
                       ],
                   ],
               ],
           ]); ?>

Usage

Drag handler :

<?php use toir427\nestable\Nestable; ?>
<?= DragNestable::widget([
               'items' => [
                   [
                       'id'      => 1,
                       'content' => 'Item # 1',
                   ],
                   [
                       'id'      => 2,
                       'content' => 'Item # 2',
                   ],
                   [
                       'id'      => 3,
                       'content' => 'Item # 3',
                   ],
                   [
                       'content'  => 'Item # 4 with children',
                       'id'       => 4,
                       'children' => [
                           [
                               'id'      => 5,
                               'content' => 'Item # 4.1',
                           ],
                           [
                               'id'      => 6,
                               'content' => 'Item # 4.2',
                           ],
                           [
                               'id'      => 7,
                               'content' => 'Item # 4.3',
                           ],
                       ],
                   ],
               ],
           ]); ?>