PHP code example of slatiusa / yii2-treetable

1. Go to this page and download the library: Download slatiusa/yii2-treetable library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

slatiusa / yii2-treetable example snippets


$ php composer.phar 

    <?= 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' => [
            ...
        ]
    ]);