Reputation: 2459
I wanna make some CGridView table in a view. And one column should contain DropDown list. Main problem is, that this dropdown list must be generated by model.
So, in my view i made it like this:
$this->widget('zii.widgets.grid.CGridView', array(
'dataProvider'=>$orders->search(),
'filter' => $orders,
'columns' => array(
array(
'name' => 'actions',
'header' => 'Actions',
'value' => '$data->actions',
'filter' => false,
),
));
And in Order model:
public function getActions() {
return CHtml::dropDownList('status', $this->status->id, CHtml::listData(Status::model()->findAll(), 'id', 'title'));
}
And i getting pretty nice column value with code of this dropdown list, but all special chracters encoded to lt; quot; gt; etc. Just string, not html element.
So, how to get real html dropdown list?
[SOLVED] just adding 'type' => 'raw' for this column solved all this problems
Upvotes: 0
Views: 7656
Reputation: 500
Special characters in a CGridView are encoded by default. Try adding the following to your columns array:
'type' => 'raw'
// Edit: Oops, read your question too fast. I see you've already found the solution yourself. :)
Upvotes: 6