CButtonColumn->columns->options current row attributes

I’m displaying my table data using CGridView…

I had this idea to show some not-so-important data on the mouseover of some icon using something like the overlib.js…

Soemthing like this could be usefull:




$this->widget('zii.widgets.grid.CGridView', array(

    'dataProvider'=>$dataProvider,

    'columns'=>array(

        'id',

        'name',

        array(

            'class'=>'CButtonColumn',

            'buttons'=>array(

                 'imageUrl'=>'...',

                 'options'=>array(

                    'onmouseover'=>"return overlib('Timestamp:".$data->timestamp."');",  //   <-- !!!

                    'onmouseout'=>"nd();",

                  ),

            ),

        ),

    ),

)); ?>



But this is not working because the htmlOption is not evaluated with the current row data…

Looking at the CButtonColumn.renderButton I think this could be implemented by changing the line




$options=isset($button['options']) ? $button['options'] : array();



to some lines calling the evaluateexpression like:




$options=array();

if(isset($button['options'])){

   foreach($button['options'] as $key=>$value){

       $options[$key]=$this->evaluateExpression('return '.$value,array('row'=>$row,'data'=>$data))

   }

}



This way $data->attribute could be evaluated… but I’m not sure if that is the optimal solution… maybe to use it just for some options like mouseover, mouseout, …

I hope some of th edeveloper will take this in consideration :)

You can write your own CButtonColumn class.

I have also question question about CGridColumn class.

I have two grid views in one view, one is for subcategories and second is for products in current category. Is it possible to change links for update, view and delete in products grid view so they were pointing on action in product Controller or I have to write my own CGridColumn class?

And I have some problem because I made my own GridColumn class for moving categories up and down, but when i use it buttons in default class stop working. Delete works fine, but update and view use ajax instead of opening url. I don’t know why:/.