Yii , show tooltip in cgridview( table ) value

php, yii

Solution

Try this:

array(
    'name'=>'Comment',
    'header'=>'Comment',
    'type'=>'raw',
    'value'=>'( strlen($data["comment"]) > 35
        ? CHtml::tag("span", array("title"=>$data["comment"]), CHtml::encode(substr($data["comment"], 0, 35)) . "..")
        : CHtml::encode($data["comment"])
    );',
),

Problem

I want to show tooltip in cgridview value as on hover on column it have to show whole contant stored in variable. I want to show contant in variable $data["comment"] as a tooltip ( title ), and currently it shows whole string as - $data["comment"]. ``` array( 'name'=>'Comment', 'header'=>'Comment', 'value'=>'(strlen($data["comment"])>35)?substr($data["comment"], 0, 35)."..":$data["comment"];', 'htmlOptions'=>array('title'=>'$data["comment"]'), // this what i have do ), ```

Original source