How to extendinc CbuttonColumn

Hi sir,

I use CGridView to view my data.

here is my view

<div style="border-bottom:1px solid maroon;margin-bottom:10px;">

    <div style="float:left;width:80%;"><?php echo CHtml::link(CHtml::encode('Add New'), array('admin/create')); ?></div>

    <div style="float:right;width:20%;color:maroon;font-size:18px;text-align:right;">Admin User</h1</div>

    <div style="clear:both;"></div>


<?php $this->widget('zii.widgets.grid.CGridView', array(

	'dataProvider' => $dataProvider,















                        'name' => 'status',

                        'value' => 'SuperAdmins::lookup_item($data->status)'






)); ?>

I using class CButtonColumn and defaultly it was provide 3 button for each record ( Detail, Update anda Delete)

The problem is, I want add some button (Publish and Hide) button. both button will be displayed alternately (not together). how I can do this sir…

thank you very much…

Dan Din Dun

I guess you can either add a behavior or extend the class and use ButtonColumn in your cgridview instead of CButtonColumn.

I’m not sure for the behavior way as cgridview takes a classname as argument and not a object

class ButtonColumn extends CButtonColumn



	 * @var array the configuration for additional buttons. Each array element specifies a single button

	 * which has the following format:

	 * <pre>

	 * 'buttonID' => array(

	 *     'label'=>'...',     // text label of the button

	 *     'url'=>'...',       // the PHP expression for generating the URL of the button

	 *     'imageUrl'=>'...',  // image URL of the button. If not set or false, a text link is used

	 *     'options'=>array(...), // HTML options for the button tag

	 *     'click'=>'...',     // a JS function to be invoked when the button is clicked

	 * )

	 * </pre>

	 * Note that in order to display these additional buttons, the {@link template} property needs to

	 * be configured so that the corresponding button IDs appear as tokens in the template.


public $buttons= array(









Ok sir… thanks, I will try it… :slight_smile: