CGridView questions

First of all, I love the zii widgets, they can save a lot of coding time, but I’m wondering if it’s possible to customize the CButtonColumn? For example, I want the delete button to be visible to only admins, and only admins and moderator can view the update button.

Does using the array(name,value) in columns will significantly affect performance? Let’s say I want to use the date formatter, I would use the following code for the column:


		array(

			'name' => 'date',

			'value' => 'Yii::app()->dateFormatter->format(Yii::app()->params[\'dateFormat\'],$data->date)'

		),

that would mean that I will have to eval the "value" code and call the Yii:app() multiple times,using the date() is probably better in terms of performance but I prefer to use the dateformatter, any suggestions?

Edit: Solved: editing the ‘template’ property or extending the CButtonColumn worked great.

How to extend CButtonColumn ?

Where do I create & keep the new extended class file ?

Can you post some samples ?

As far as I know there aren’t many things in Yii that you actually can’t customize! :) Yes, of course, you can custiomize CButtonColumn and you can do this in a very flexible way.

Unless you need something very, very weird, you don’t have to write own class inheriting from CButtonColumn, because you can cutomize base class very flexible.

Look into cookbook article, I wrote about this. I placed there some examples and a bit of explanation on customizing CButtonColumn.