toir427/yii2-nestable

Yii2 Nestable

安装次数: 91

依赖: 0

建议者: 0

安全: 0

星标: 0

关注者: 1

分支: 0

开放问题: 2

类型:yii2-extension

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

This package is auto-updated.

Last update: 2024-09-06 20:50:07 UTC


README

Yii2 Nestable

安装

安装此扩展的首选方式是通过 composer.

运行

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

或将以下内容添加到您的 composer.json 文件的 require 部分中。

"toir427/yii2-nestable": "*"

要么运行

截图

用法

基本可嵌套列表

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

用法

拖动处理程序

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