CLinkColumn and filter

I am using YII framework. I will make an email link on my list from GRID. I added:

array(
    'class'=>'CLinkColumn',
    'header'=>'e-mail',
    'labelExpression'=>'$data->email',
    'urlExpression'=>'"mailto:".$data->email',
),

      

this works fine, but now i am not filtering the hava column. CLinkColumns has no method filter. How can I make a mailto: link and use a filter for that?

+3


source to share


3 answers


You can also try something like this:



array(
   'name' => 'email',
   'header' => 'e-mail',
   'type' => 'raw',
   'value' => 'CHtml::link($data->email,"mailto:".$data->email)'
),

      

+7


source


You cannot use a filter with CLinkColumn.


Yii developers discussed the addition 'name'

in CLinkColumn

here: https://github.com/yiisoft/yii/pull/970

They decided against:

... there is no need to "complicate" [CLinkColumn] further as it will simply be duplicate code or hacks to solve problems ...



samdark says:

CLinkColumn will be available for simple use only. If you need more options, consider using a value.

This is their recommended alternative:

array(
  'name' => 'field_name',
  'type' => 'raw',
  'value' => 'CHtml::link($data->field_name,$data->field_name)'
),

      

0


source


take a picture this way -

array(
  'class'=>'CLinkColumn',
  'header'=>'e-mail',
  'labelExpression'=>'$data["email"]',
  'urlExpression'=>'"mailto:".$data["email"]',
),

      

-3


source







All Articles