How can i add additional button in the CGridView?

Hi,I have a view with CGridView,default there are three button(view,update,delete) per row,I want add addtional buttons,i saw code:




array(

	'class'=>'CButtonColumn',

)



i try to add like this:




array(

	'class'=>'CButtonColumn',array(

		'buttons'=>array(

			'myButton'=>array(

				'label'=>'My Button',

				'url'=>'#',

				'imageUrl'=>'images/loading.gif',

			)

		)

	)

)



but throw a exception,please tell me how to add my buttons,thank you very much!


'class'=>'CButtonColumn',

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

                        'header'=>'Actions',

                        'buttons'=>array('reg' => array(

	      'label'=>'register', 

	      'url'=>'Yii::app()->createUrl("program/register",array("participant_id"=>$data->primarykey))',



make sure that you include the ‘template’ code

in this example {reg} matches button ‘reg’ I think that this would be a requirement, I didn’t try it with mismatched identifiers but it works like this, I’m not sure how to reference an image I didn’t get that far yet :)

doodle

cool!

thank you very much!

ok, so how to change width of buttons column, it has 60 px setted by widget css.




		array(

			'class'=>'CButtonColumn',

			'template'=>'{view} {update} {reg}',

			'header'=>'Actions',

			'buttons'=>array(

				'register' => array(

					'label'=>'Register',

					'url'=>'Yii::app()->createUrl("group/register",array("group_id"=>$data->group_id))',

					'imageUrl'=>Yii::app()->request->baseUrl.'/images/register.png',

				),

			),

			'htmlOptions'=>array('width'=>100),

		),