CGridview条件删除按钮 [英] CGridview conditional delete button
本文介绍了CGridview条件删除按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望删除按钮仅在 CGgridView
CButtonColumn
中的某些情况下处于活动状态(或者进行自定义删除按钮)例如,如果 user =='admin'
或 status =='draft'
。有任何想法吗?
I want the delete button to be active only in certain condition in CGgridView
CButtonColumn
(or make a custom delete button) e g if user=='admin'
or status=='draft'
. Any ideas? Thanks!
推荐答案
使用'visible'参数 -
use 'visible' parameter -
'buttons'=>array
(
'delete' => array
(
'label'=>'Delete',
//other params
'visible'=>!Yii::app()->user->checkAccess('admin'),
),
这篇关于CGridview条件删除按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文