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

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) »


Title unchanged

Using CButtonColumn to customize buttons in CGridView

Category unchanged


Yii version unchanged

Tags unchanged

CButtonColumn, CGridView, customize, buttons

Content changed

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:
'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:
74 0
Viewed: 299 709 times
Version: 1.1
Category: How-tos
Written by: Trejder
Last updated by: Gismo
Created on: Nov 20, 2010
Last updated: 5 years ago
Update Article


View all history