Hi to all again ^^, i have a new doubt, i want add a new button on CGridView provided for admin.php (script generated by CRUD generate), the code of this is the next:
I guess is adding something down of ‘class’ => ‘CButtonColumn’, but i dont know how and if this is posible. I want this because i want go to another form of another model with this id. e. g:
I have a model: person and cars
i want in the admin of person ‘click’ in a button of one person and go to a create form of cars with the id of this person.
CButtonColumn::template and CButtonColumn::buttons are the keys.
array(
'class' => 'CButtonColumn',
'template' => '{view} {update} {delete} {copy}',
'buttons'=>array(
'copy' => array(
'label'=>'Copy', // text label of the button
'url'=>"CHtml::normalizeUrl(array('copy', 'id'=>\$data->id))",
'imageUrl'=>'/path/to/copy.gif', // image URL of the button. If not set or false, a text link is used
'options' => array('class'=>'copy'), // HTML options for the button
),
),
),
First, add some button name to the template. I added ‘copy’ button.
If you don’t want some of the default buttons (i.e. view, update and delete), you may omit it.
Second, define the properties of the button that you added. I defined label, url, image and html options.
All the information regarding this could be retrieved from the reference manual.