我想在 yii 的权限模块的 cgridview 中添加过滤器。
这是权限模块的 cgridview
<?php $this->widget('zii.widgets.grid.CGridView', array(
'dataProvider'=>$dataProvider,
'template'=>"{items}\n{pager}",
'emptyText'=>Rights::t('core', 'No users found.'),
'htmlOptions'=>array('class'=>'grid-view assignment-table'),
//'filter'=>$dataProvider,
'columns'=>array(
array(
'name'=>'name',
'header'=>Rights::t('core', 'Name'),
'type'=>'raw',
'htmlOptions'=>array('class'=>'name-column'),
'value'=>'$data->getAssignmentNameLink()',
'filter'=>'name',
),
array(
'name'=>'assignments',
'header'=>Rights::t('core', 'Roles'),
'type'=>'raw',
'htmlOptions'=>array('class'=>'role-column'),
'value'=>'$data->getAssignmentsText(CAuthItem::TYPE_ROLE)',
),
/*
array(
'name'=>'assignments',
'header'=>Rights::t('core', 'Tasks'),
'type'=>'raw',
'htmlOptions'=>array('class'=>'task-column'),
'value'=>'$data->getAssignmentsText(CAuthItem::TYPE_TASK)',
),
array(
'name'=>'assignments',
'header'=>Rights::t('core', 'Operations'),
'type'=>'raw',
'htmlOptions'=>array('class'=>'operation-column'),
'value'=>'$data->getAssignmentsText(CAuthItem::TYPE_OPERATION)',
),
*/
)
)); ?>
这是assignmentcontroller的actionview
public function actionView()
{
// Create a data provider for listing the users
$dataProvider = new RAssignmentDataProvider(array(
'pagination'=>array(
'pageSize'=>50,
),
));
// Render the view
$this->render('view', array(
'dataProvider'=>$dataProvider,
));
}
如何将过滤器添加到权限模块的 cgridview 中?