Yii Framework Forum: Tbgridview Link - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Tbgridview Link Rate Topic: -----

#1 User is offline   Liam Carter 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 18
  • Joined: 30-August 12

Posted 29 October 2012 - 03:25 AM

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
0

#2 User is offline   ktwbc 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 13
  • Joined: 06-December 11

Posted 28 February 2013 - 03:36 PM

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',
		),
	),
));

2

#3 User is offline   iUsmanMalik 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 30-October 13

Posted 20 December 2013 - 06:49 AM

<?php $this->widget('bootstrap.widgets.TbGridView', array(
'id' => 'jobs-grid',
'template' => '{items}',
'dataProvider' => $dataProvider,

'columns' => array(

array(
'name'=>'title',
'type' => 'raw',
'value'=>'CHtml::link($data->title, $data->url)',

),

),

)); ?>
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users