[SOLVED] zii.widgets.grid.CGridView, CButtonColumn

Hi guys, I have a problem when I created CButtonColumn just to using view.

Here’s my code :


<?php $this->widget('zii.widgets.grid.CGridView', array(

			'itemsCssClass'=>'table table-striped table-bordered table-hover',

			'id'=>'Search-grid',

			'dataProvider'=>$data->getList(),


			//'filter'=>$model,

			'columns'=>array(

                                'username',

				'name',

                                'address',

				array('header'=>'Options','class'=>'CButtonColumn',

      				  'viewButtonUrl'=>'Yii::app()->controller->createUrl("/task/view",array("id"=>$data["id"]))',),

		

	),

));

?>

When I ran it, it show error.

Trying to get property of non-object

error : eval()'d code(1)

I’ve tried to solve it. I used source code like this :


array('header'=>'Options','class'=>'CButtonColumn',

      				  'template'=>'{view}',),

But it still showed error result again.

I hope anybody help me.

I don’t remember where to find a good example of how to configure CGridview.

Check out the first post in this thread.

Did you try to remove the code below?


'header'=>'Options',

Thank you for your answer :)

Thank you, but that was not about header. I’ve gotten the way to fix it. I just mixed :


array('header'=>'Options','class'=>'CButtonColumn',

      				  'viewButtonUrl'=>'Yii::app()->controller->createUrl("/task/view",array("id"=>$data["id"]))', 'template'=>'{view}',

    				  ),

. It solved. Thank you :)