Articles tagged with "htmloptions"X
Displaying 1-4 of 4 result(s).

Yii 1.1: Cgridview: Use Special Variable $Data In The Options Of A Button (I.e. Evaluate Options Attribute)

Created 3 years ago by Louis GacTutorials1 comment – viewed 12,376 times – ( +6 / -1 ) – version 1.1
For each column of the CGridView, we can specify customized buttons : Customize Buttons in CGridWiew

CButtonColumn: Use special variable $data for the 'id' in the 'options' of a button

Created 5 years ago by bluezedTutorials5 comments – viewed 33,101 times – ( +10 / -2 ) – version 1.1
In an application I had a CGridView with a CButtonColumn and for an Ajax-Request I needed to make sure that the IDs of the buttons would not change when the GridView was updated so in effect I wanted to link them to the $data->id. So I tried:

CGridView: Use special variable $data in the htmlOptions of a column (i.e. evaluate htmlOptions attribute)

Created 5 years ago by c@cbaTutorials3 comments – viewed 64,619 times – ( +28 / -2 ) – version 1.1
    For each column of the CGridView, we can specify name, value, htmlOptions, cssClassExpression etc. In the declarations of the attributes value and cssClassExpression we can use the "special" variable $data, for example like this: 'value'=>'$data->author->username',.     Now we might want to use $data in the declaration of the htmlOptions attribute, which is normally not possible, to generate for example the tag <td id="3" class="name_3">, where 3 is the id of the data model for the current row, i.e. $data->id. That is, we want to be able to use: 'htmlOptions'=>array('id'=>'$data->id', 'class'=>'"name_{$data->id}"')     Here's a way to accomplish this...

htmlOptions explained for various controls.

Created 6 years ago by WoilTips1 comment – viewed 56,244 times – ( +18 / -1 ) – version 1.1
Most controls that are rendered by CHtml have an argument called $htmlOptions. This argument is an array that holds the attributes of the HTML element. For example the following code: