Revision #4 has been created by Trejder on Mar 22, 2011, 9:18:42 AM with the memo:
Updated information about label/options params of each button.
« previous (#3) next (#5) »
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.
2. If you provide an empty string for **imageUrl** or set it to false, a textual link will be used instead.
Finally here is an example of introducing new buttons to CButtonColumn:[...]