Tbgridview Link


(Liam) #1

Hiya All.

I am starting a new project and i am using YiiBooster with Yii Bootstrap

I have an issue with creating a url link within the columns of the TbGridView.




$this->widget('bootstrap.widgets.TbGridView',array(

	'type'=>'striped bordered condensed',

	'id'=>'accounts-grid',

	'dataProvider'=>$model->search(),

	'columns'=>array(

		array(

	   	'name'=>'id',

		   'header'=>'ID',

		   'type'=>'raw',

		   'value'=>'$data->id',

		   'htmlOptions'=>array('width'=>'40'),

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

	   ),

		'name',

		'phone',

		'mobile',

		'type',

		'account_manager',

		'status',

		array(

			'class'=>'bootstrap.widgets.TbButtonColumn',

		),

	),

));



The ‘url’ option doesn’t work and throws the following error.

"Property "TbDataColumn.url" is not defined."

I have tried ‘urlExpression’ as well.

Any ideas.

Thanks for your help in advance.

Regards

Liam


(Kris White) #2

Try:




$this->widget('bootstrap.widgets.TbGridView',array(

	'type'=>'striped bordered condensed',

	'id'=>'accounts-grid',

	'dataProvider'=>$model->search(),

	'columns'=>array(

		array(

	   	'name'=>'id',

		   'header'=>'ID',

		   'type'=>'raw',

		   'value'=>'CHtml::link($data["id"],Yii::app()->createUrl("meetings/view", array("id"=>$data["id"])))',

		   'htmlOptions'=>array('width'=>'40'),

			

	   ),

		'name',

		'phone',

		'mobile',

		'type',

		'account_manager',

		'status',

		array(

			'class'=>'bootstrap.widgets.TbButtonColumn',

		),

	),

));




(Iusmanmalik) #3

<?php $this->widget(‘bootstrap.widgets.TbGridView’, array(

'id' =&gt; 'jobs-grid',


'template' =&gt; '{items}',


'dataProvider' =&gt; &#036;dataProvider,





'columns' =&gt; array(


 


     array(


		'name'=&gt;'title',


         'type'  =&gt; 'raw',


		'value'=&gt;'CHtml::link(&#036;data-&gt;title, &#036;data-&gt;url)',


       


	),





),

)); ?>