### 关键点:主键必须是数字
```
`<?=TreeGrid::widget(\[
'dataProvider'\=>$dataProvider,
'keyColumnName'\=>'id',
'parentColumnName'\=>'parent\_id',
'parentRootValue'\=>'0',
'pluginOptions'\=>\[
'initialState'\=>'collapsed',
// 'expanderTemplate'=> '    |---',
\],
'columns'\=>\[
\['class'\=>'yii\\grid\\SerialColumn'\],
// \[
// 'attribute' => 'parent\_id',
// 'label' => Yii::t('rbac-admin', 'parent\_id'),
// \],
\[
'attribute'\=>'name',
'label'\=>Yii::t('rbac-admin','Name'),
\],
\[
'attribute'\=>'description',
'label'\=>Yii::t('rbac-admin','Description'),
\],
\[
'attribute'\=>'ruleName',
'label'\=>Yii::t('rbac-admin','Rule Name'),
// 'filter' => $rules
\],
\[
'class'\=>'common\\components\\ActionColumn',
'urlCreator'\=>function($action,$model,$key,$index){
switch($action)
{
case'delete':
returnUrl::to(\['delete','id'\=>$model\->name,'module\_name'\=>$model\->module\_name\]);
break;
case'view':
returnUrl::to(\['view','id'\=>$model\->name,'module\_name'\=>$model\->module\_name\]);
break;
case'update':
returnUrl::to(\['update','id'\=>$model\->name,'module\_name'\=>$model\->module\_name\]);
break;
}
},
\],
\],
\]);
?\>`
```