承接 agtong/yii2-treetable 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

agtong/yii2-treetable

最新稳定版本:v1.0.0

Composer 安装命令:

composer require agtong/yii2-treetable

包简介

Yii 2.0 implementation of tree table behavior using jquery-treetable plugin.

README 文档

README

Yii 2.0 implementation of tree table behavior using jquery-treetable plugin. Provides a Gridview like widget.

Installation

The preferred way to install this extension is through composer.

Either run

$ php composer.phar require agtong/yii2-treetable

or add

"agtong/yii2-treetable": "*"

to the require section of your composer.json file.

Usage

Use agtong\treetable\Treetable widget instead of a Yii Gridview. The example below will collapse every even row in the table below the odd one above it.

    <?= Treetable::widget([
        'dataProvider' => $dataProvider,
        'rowOptions' => function($model, $key, $index, $grid) {
            if ($index % 2) {
                return ['data-tt-id' => $index, 'data-tt-parent-id' => $index-1];
            } else {
                return ['data-tt-id' => $index];
            }
        },
        'treetableOptions' => ['expandable' => true, 'indent' => 0], //Pass configuration options to $().treetable()
        // 'useOwnCss' => true, // default is false.
        // eg. add to view -> $this->registerCssFile(Yii::getAlias('@web') . '/css/your_own_treetable.css');
        'columns' => [
            ...
        ]
    ]); ?>

Read the documentation on treetable (http://ludo.cubicphuse.nl/jquery-treetable/) to understand how working with the data-tt-id and data-tt-parent-id can determine the nesting. A function for rowOptions as shown above can work with your datamodel to nest as you like.

Tip

Not all CSS from treetable is included because it breaks heavilly with Bootstrap layout. A css example is included to style the expand/collapse <a> with an image. Take a look at the CSS provided with jquery-treetable for more inspiration.

统计信息

  • 总下载量: 33
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: BSD
  • 更新时间: 2023-10-20