Yii CGridview Button Configuration

In this article, I explained about Cgridview "CButtonColumn" of yii framework.

Here I have added new button and assigned customized url to new button. We can change the url to "view","update","delete" button also.


<?php $this->widget('zii.widgets.grid.CGridView', 
    array(
        'id'=>'user-grid',
        'dataProvider'=>$model->search(),
        'columns'=>array(
            'username',
            'type',
            array(
                'class'=>'CButtonColumn',
                'template'=>'{view}{update}{delete}{newbutton}',
                'buttons'=>array(
                    'newbutton'=>array(
                        'label'=>'Click',
                        'url'=>'Yii::app()->createAbsoluteUrl('controller/action')
					)',
                    'visible'=>'$data["type"]=="admin"?false:true',
                ),                               
            ),
        ),
    ),
); 
?>