2017 © Pedro Peláez
 

yii2-extension yii2-treetable

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

image

slatiusa/yii2-treetable

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

  • Saturday, January 21, 2017
  • by slatiusa
  • Repository
  • 2 Watchers
  • 1 Stars
  • 58 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

yii2-treetable

Yii 2.0 implementation of tree table behavior using jquery-treetable plugin. Provides a Gridview like widget. - jquery-treetable - http://ludo.cubicphuse.nl/jquery-treetable/, (*1)

Installation

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

Either run, (*3)

$ php composer.phar require slatiusa/yii2-treetable

or add, (*4)

"slatiusa/yii2-treetable": "*"

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

Usage

Use slatiusa\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., (*6)

    <?= 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()
        '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., (*7)

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., (*8)

The Versions

21/01 2017

dev-master

9999999-dev https://github.com/ASlatius/yii2-treetable

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

  Sources   Download

BSD 3-Clause

The Requires

  • bower-asset/jquery-treetable ^3.2

 

by Arno Slatius

extension yii2 jquery table widget tree gridview treetable

21/01 2017

1.0.1

1.0.1.0 https://github.com/ASlatius/yii2-treetable

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

  Sources   Download

BSD 3-Clause

The Requires

  • bower-asset/jquery-treetable ^3.2

 

by Arno Slatius

extension yii2 jquery table widget tree gridview treetable

21/01 2017

v1.0

1.0.0.0 https://github.com/ASlatius/yii2-treetable

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

  Sources   Download

BSD 3-Clause

The Requires

  • bower-asset/jquery-treetable ^3.2

 

by Arno Slatius

extension yii2 jquery widget gridview treetable