Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to put javascript link in a value array of the cgridview?

e.g I want to have a link, that when i click it, it will call this inside the CGridView array of yii framework ?

$('.blah').fancybox();

how to add that in a

array(
         'header'=>'Image',
         'type'=>'raw',
         'value'=> "",
              ),
like image 418
sasori Avatar asked Jan 01 '26 02:01

sasori


1 Answers

You can use CLinkColumn's linkHtmlOptions instead:

array(
    'class'=>'CLinkColumn',
    'linkHtmlOptions'=>array('onclick'=>'$(".blah").fancybox();'),
    'header'=>'Image',
    'label'=>'For Static Labels',// use label for static labels
    'labelExpression'=>'"Dynamic label".$row'// use labelExpression for dynamic label
) 
like image 59
bool.dev Avatar answered Jan 02 '26 17:01

bool.dev



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!