Widget to display the nested sets tree as a grid
Based on GridView
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist koperdog/yii2-treeview "*"
or add
"koperdog/yii2-treeview": "*"
to the require section of your composer.json
file.
Add to your model field:
public $children = null;
echo koperdog\yii2treeview\TreeView::widget([
'dataProvider' => $dataProvider,
//'depthPrefix' => ' — ', //see Additional options
//'depthRoot' => 1, //see Additional options
//'collaplse' => true, //see Additional options
'columns' => [
'id',
'name',
'created_at:datetime',
// ...
],
]);
['class' => '\koperdog\yii2treeview\base\CheckboxColumn'],
['class' => '\koperdog\yii2treeview\base\ActionColumn'],
['class' => '\koperdog\yii2treeview\base\RadioButtonColumn'],
['class' => '\koperdog\yii2treeview\base\SerialColumn'],