Question

I will need have changed visited row in CGridView on another color. What do I need to do to solve it? I found JavaScript or CSS way, but I didn't find any even approximate method. I know what I can change visited link

a:visited
{
    color: #green;
}

but how do I change color of visited row? Maybe, does Jquery have some method?

UPD: I have a CGridView table, I need to visited rows looked another color.

$this->widget('zii.widgets.grid.CGridView', array(
  'dataProvider'=>$dataProvider,
  'columns'=>array(
    'title',          
    array(            
        'name'=>'authorName',
        'value'=>'$data->author->username',
    ),
    array(
        'class'=>'CButtonColumn',
    ),
),
));

How will have I done?

Was it helpful?

Solution

Try so:

$this->widget('zii.widgets.grid.CGridView', array(
  'selectableRows'=>1,
  'selectionChanged'=>'function(id){
        var selected_tr = $.fn.yiiGridView.getSelection(id);
        $("#"+id).find("tr#"+selected_tr).css("background-color", "red");
        }',
  'dataProvider'=>$dataProvider,
  'columns'=>array(
    'title',          
    array(            
        'name'=>'authorName',
        'value'=>'$data->author->username',
    ),
    array(
        'class'=>'CButtonColumn',
    ),
),
));

Is that what you want?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top