Yii2 Nestable
Yii2 Nestable, (*1)
Installation
The preferred way to install this extension is through composer., (*2)
Either run, (*3)
php composer.phar require --prefer-dist toir427/yii2-nestable "*"
or add, (*4)
"toir427/yii2-nestable": "*"
to the require section of your composer.json
file., (*5)
Screenshot
, (*6)
Usage
Basic nestables :, (*7)
<?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 :, (*8)
<?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',
],
],
],
],
]); ?>