Tbgridview And Render Customized/complex Datacolumns

Hi All,

I am getting the following error:

htmlspecialchars() expects parameter 1 to be string, array given

when trying to do customized/complex datacolumns.

I have the following code:

<?php $this->widget('ext.bootstrap.widgets.TbGridView', array(


    'type'=>'striped bordered condensed',





        array('name'=>'show_name', 'header'=>'Show'),

        array('name'=>'show_date', 'header'=>'Date'),

        array('name'=>'judge', 'header'=>'Judge'),

        array('name'=>'StatusText', 'header'=>'Status'),



            'type'=>'raw', //because of using html-code from the rendered view

            //call the method 'gridMemberColumn' from the controller







)); ?>

with gridEntryColumn defined as:

    protected function gridEntryColumn($data,$row)


       $sql = 'SELECT entry_id, name, stud_name, member FROM lag_entry WHERE show_id = ' . $data->show_id .' ORDER BY name';

       $rows = Yii::app()->db->createCommand($sql)->queryAll();

       $result = '1';

       $idx = 1;


           foreach ($rows as $row)


               $url = Yii::app()->createUrl('entry/view',array('entry_id'=>$row['entry_id']));

               $style = $idx % 2 == 0 ? 'background:#F8F8F8; padding:0.5em;' : 'background:#E5F1F4; padding:0.5em;';

               $text = CHtml::tag('div',array('style'=>$style),$row['name'].' '.$row['stud_name']);

               $result .= CHtml::link($text,$url) .'<br/>';



       return $result;


now if I replace the TbGridZView with a CGridView it works correctly but I prefer a TbGridView. It appears more to be something to do with searching but I am not positive.

This is part of the stack trace:

Stack Trace



 C:\xampp\htdocs\yii\framework\web\helpers\CHtml.php(85): htmlspecialchars(array(), 3, "UTF-8")



 C:\xampp\htdocs\yii\framework\web\helpers\CHtml.php(2216): CHtml::encode(array())



 C:\xampp\htdocs\yii\framework\web\helpers\CHtml.php(140): CHtml::renderAttributes(array("name" => "Rabbitshow[entries]", "type" => "text", "value" => array()))



 C:\xampp\htdocs\yii\framework\web\helpers\CHtml.php(1890): CHtml::tag("input", array("name" => "Rabbitshow[entries]", "type" => "text", "value" => array()))



 C:\xampp\htdocs\yii\framework\web\helpers\CHtml.php(1217): CHtml::activeInputField("text", Rabbitshow, "entries", array("name" => "Rabbitshow[entries]"))



 C:\xampp\htdocs\yii\framework\zii\widgets\grid\CDataColumn.php(98): CHtml::activeTextField(Rabbitshow, "entries", array("id" => false)) 

Any ideas?

Change line:


into something like this

'value'=>function($row){return $this->gridEntryColumn($model, $row)}


'value'=>"$this->gridEntryColumn($model, $row)"


Thanks for that but neither worked and returned the same error.