ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
### 关键点:主键必须是数字 ``` `<?=TreeGrid::widget(\[ 'dataProvider'\=>$dataProvider, 'keyColumnName'\=>'id', 'parentColumnName'\=>'parent\_id', 'parentRootValue'\=>'0', 'pluginOptions'\=>\[ 'initialState'\=>'collapsed', // 'expanderTemplate'=> '&nbsp&nbsp&nbsp&nbsp|---', \], '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; } }, \], \], \]); ?\>` ```