Some problem with 'buttons' ('url') in CGridView

Hi all

I need to use my action for delete lines in table instead of default actionDelete.


class AdminController extends CController {


    public function actionUserDelete($id) {

        if (!empty($id))







and views/admin/user.php

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


	'columns' => array(




			'class' => 'CButtonColumn',

			'template' => '{delete}',


                        'buttons' => array(

				'delete' => array(

				    'url' => 'Yii::app()->createUrl("admin/userDelete", array("id"=>$data->id))',	






But it doesn’t work. I see only blank page without any content. Tried to comment section ‘buttons’ in view and it almost worked(exclude delete button).

Can smb explain me how to fix it?

If you want to set another URL for the default ‘delete’ button… use deleteButtonUrl -

mdomba, thanks for useful man, but the problem was in unclosed bracket at the end of grid widget >_< (I killed few days for searching solution).

think this topic can be closed/deleted

No need to close it or delete… it will be good for other users if they will have similar problem…

What about if I want to trigger some javascript unstead of redirect to and url


'template' => '{view} {delete}',            

'buttons' => array(  

    'view' => array( 

       'url' => 'SOME JAVASCRIPT ACTION',        


    'delete' => array( 

        'url' => 'Yii::app()->createUrl("admin/userDelete", array("id"=>$data->id))',        



any idea?

I think I got it

'view' => array( 

    'url' => 'Yii::app()->createUrl("admin/userView", array("id"=>$data->id))',

    'click' => 'function() {

          alert(\'Hello world\'); 

	  return false


You’d do something like this: