mybuttoncolumn extension to make CButtonColumn different in CGridView from row to row depending on data in single rows

  1. Documentation
  2. Change Log

NOTE: As of Yii version 1.1.1 the visible attribute is added to the core, so this extension is NOT NEEDED.

myButtonColumn extends CButtonColumn in CGridView and adds the attribute 'visible' to the buttons properties so that the buttons can be different from row to row depending on the evaluation of this attribute.

For the default buttons adds:

  • viewButtonVisible
  • updateButtonVisible
  • deleteButtonVisible.

Documentation

Requirements
  • Yii 1.0 or above
Installation
  • Extract the release file under protected/components
Overview

myButtonColumn extends CButtonColumn in CGridView and adds the attribute 'visible' to the buttons properties so that the buttons can be different from row to row depending on the evaluation of this attribute.

Additionaly, for the default buttons, adds:

  • viewButtonVisible
  • updateButtonVisible
  • deleteButtonVisible
Usage

Use it like CGridButton

<?php
$this->widget('zii.widgets.grid.CGridView', array(
  'dataProvider'=>$dataProvider,
  'columns'=>array(
    'name',
    'type',
    array(
      'class'=>'myButtonColumn',
      'viewButtonVisible'=>'$data->id==Yii::app()->user->id',
      'updateButtonVisible'=>'$data->id==Yii::app()->user->id',
      'deleteButtonVisible'=>'User::canDelete($data->id)',
    ),
  ),
));
?>

Change Log

February 18, 2010
  • Initial release.
7 1
4 followers
874 downloads
Yii Version: 1.1
License: (not set)
Category: User Interface
Tags:
Developed by: Maurizio Domba Cerin
Created on: Feb 18, 2010
Last updated: 7 years ago

Downloads

show all