I would like to have a CGridView column that displays all tags for each model listed in the index (list) and admin views. I've tried some thing like this in CGridView:
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id' => 'disks-grid',
'dataProvider' => $model->search(),
'filter' => $model,
'columns' => array(
// additional column definitions
array(
'name' => 'tags_with_model',
'header' => 'Tags',
'type' => 'raw',
'filter' => FALSE,
'value' => $model->tags_with_model->toString(),
),
// ,,,
Unfortunately, that produces nothing. No errors, just a totally blank column. (Interestingly, I was able to use tags_with_model->toString(); ?> to display the tags in view.php, and it worked quite nicely.) Apparently, something happens in CGridView to prevent toString() from working.
By the way, my behavior in the model looks like:
public function behaviors() {
return array(
'tags_with_model' => array(
'class' => 'ext.yiiext.behaviors.model.taggable.ETaggableBehavior',
'tagTable' => 'tag',
'tagBindingTable' => 'disks_tag',
'modelTableFk' => 'disksId',
'tagTablePk' => 'id',
'tagTableCount' => 'frequency',
'tagBindingTableTagId' => 'tagId',
'createTagsAutomatically' => TRUE,
),
);
}
Can anyone tell me how to get a column in CGridView that displays the tags for each model?
I would like to have a CGridView column that displays all tags for each model listed in the index (list) and admin views. I've tried some thing like this in CGridView:
Unfortunately, that produces nothing. No errors, just a totally blank column. (Interestingly, I was able to use tags_with_model->toString(); ?> to display the tags in view.php, and it worked quite nicely.) Apparently, something happens in CGridView to prevent toString() from working.
By the way, my behavior in the model looks like:
Can anyone tell me how to get a column in CGridView that displays the tags for each model?