Difference between #3 and #8 of
Using CButtonColumn to customize buttons in CGridView

Changes

Title unchanged

Using CButtonColumn to customize buttons in CGridView

Category unchanged

How-tos

Yii version unchanged

Tags unchanged

CButtonColumn, CGridView, customize, buttons

Content changed

[...]
(
'class'=>'CButtonColumn',
'template'=>'{up}{down}{delete}',
)
```
For new buttons
 (and of course - for existing, build-in ones too!) you have to specify look and behaviour. **buttons** property of CButtonColumn is used for it. This property is an array of buttons id (which names must correspond to the one provided in _template_ property) and each button is another array holding its specific properties. 
 
 
Here you can use:
[...]
)
```
There are similar remarks for thesePlease, note: Text in _label_ property is displayed **only**, if you have a **textual** link! If you are using images (build-in or own) instead of text links, text hold in this property will be rendered as image's _alt_ parameter. If you want to change text of _tooltip_, which is displayed when user hovers your image button, you have to edit _options_ property instead and give the text to its _title_ parameter, like this:
 
 
 
```php 
'buttonID' => array
 
(
 
    'label'=>'Text shown as alt text to image or as label to text link...',
 
    'options'=>array('title'=>'Text shown as tooltip when user hovers image...'),
 
)
 
```
 
 
There are similar remarks for above mentioned
properties like the one described in first part of this text:

1. In PHP expression used for **url** or **visible** properties, you can use variable _$row_ for the row number (zero-based) and _$data_ for the data model for the row.
[...]
I hope this short how-to will help in better understanding of how flexible buttons in CGridView can be customized. This is especially important as there are many forum posts asking questions about this. Please, feel free to make any updates or corrections to this article, if you find something is missing or that there are mistakes in it.

Have a nice day and happy Yii-ing! :)

 
 
Russian Version: [Использование класса CButtonColumn для изменения кнопок в виджете CGridView](http://phptime.ru/blog/yii/22.html)
 
 
Chinese Version:[中文翻译](http://www.yiiwiki.com/wiki/view/id/12/title/%E4%BD%BF%E7%94%A8CButtonColumn%E8%87%AA%E5%AE%9A%E4%B9%89CGridiew%E9%87%8C%E9%9D%A2%E7%9A%84%E6%8C%89%E9%92%AE)
75 0
59 followers
Viewed: 344 715 times
Version: 1.1
Category: How-tos
Written by: Trejder
Last updated by: Gismo
Created on: Nov 20, 2010
Last updated: 11 years ago
Update Article

Revisions

View all history