Code of the CGridView
$this->widget('zii.widgets.grid.CGridView', array(
'id'=>'blu-topic-grid',
'dataProvider'=>$model->search(),
'filter'=>$model,
'columns'=>array(
array(
'name'=>'language_id',
'header'=>'',
'type'=>'html',
'value'=>'BluCategory::getLanguage2($data->language_id)',
'filter'=>BluCategory::getLanguages2(),
),
array(
'name'=>'title',
'type'=>'raw',
'value' => 'printCssTitle( $data->title, $data->url, $data->author_officer)',
),
array(
'name'=>'last_officer',
'type'=>'raw',
'value' => 'printCss( $data->last_officer, true )',
),
array(
'header'=>'Categoria',
'name'=>'category_id',
'value'=>'BluCategory::getCategory($data->category_id)',
'filter'=>BluCategory::getCategories(),
),
array(
'name'=>'last_update',
'value'=>'dateDiff( $data->last_update )',
'filter'=>false,
),
array(
'name'=>'author',
'type'=>'raw',
'value' => 'printCss( $data->author, $data->author_officer)',
),
),
));
Code in the model:
public static function getLanguage2( $item ) {
$list = self::getLanguages2();
return $list[$item];
}
public static function getLanguages2() {
$list = array();
$list[0] = CHtml::image('http://www.glhf.it/images/flags/it.png');
$list[1] = CHtml::image('http://www.glhf.it/images/flags/us.png');
return $list;
}
Result IMG:
How can I put the image also in the filter? Cause at the moment, also not showing the image but only the html of it, the search doesn’t work ( because filter is different… ) Please gimme some help!