CButton Url Issue

New to Yii. I have read the docs, browsed the forums…

Essentially I am trying to place a url into the view button:




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

												 'dataProvider'=>$dataProvider,

'columns'=> array(

'name', 

'owner.org_name', 

'owner.screen_name', 

'owner.full_name',

			array(														  'class'=>'CButtonColumn',

'template'=>'{view}',

'viewButtonLabel'=>'YO',

'viewButtonUrl'=>Yii::app()->createUrl("team/index", array("id"=>$data->id)), // id is the team id for $_GET

'viewButtonImageUrl'=>'/sim/images/email_4.png',

),

)

));



The label displays fine, the image displays, the URL is blank in the HTML and when I hover the mouse the url defaults to the current page. I am totally stumped. Oh and $data returns an error as a non-object.

I did tests and $dataProvider->data[]->whatever does display the model data so its there.

What am I missing?

The viewButtonUrl has to be a string as a PHP expression that will be evaluated for each row on displaying the grid.

So you have to assign a string:




 'viewButtonUrl'=>'Yii::app()->createUrl("team/index", array("id"=>$data->id))', 



Thanks you!! Worked.