Yii Framework Forum: How To Merge Clinkcolumn In Groupgridview - Yii Framework Forum

Jump to content

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

How To Merge Clinkcolumn In Groupgridview Rate Topic: -----

#1 User is offline   The Dancing Lemur 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 21-September 12

Posted 22 September 2012 - 08:21 AM

Hi all,
I'm quite new in Yii topics so, plase, be patient with me ;)

I used the GroupGridView extension in my application and everything works fine but the merge of a column based on a CLinkColumn.

Do you know if there's any way to merge it?

Thanks for your help!
0

#2 User is offline   bennouna 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,166
  • Joined: 05-January 12
  • Location:Morocco

Posted 22 September 2012 - 12:00 PM

Maybe you should post what you have tried till now and what results and/or errors you get.
0

#3 User is offline   The Dancing Lemur 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 21-September 12

Posted 23 September 2012 - 08:34 AM

View Postbennouna, on 22 September 2012 - 12:00 PM, said:

Maybe you should post what you have tried till now and what results and/or errors you get.


Hi bennouna,
thanks for your reply! What I did is as follows:

<?php $this->widget('ext.groupgridview.GroupGridView', array(
	'id'=>'grid1',
	'dataProvider'=>$dataProvider,
	'extraRowColumns' => array(
		'description',
	),
	'columns'=>array(
		array(
			'class'=>'CLinkColumn',
			'urlExpression'=>'Yii::app()->createUrl("task/view",array("id"=>$data->id));',
			'labelExpression'=>'$data->id',
		),
		'tdescription',
		'customer',
		'username',
		array(
			'name'=>'incharge_time',
			'value'=>'Yii::app()->dateFormatter->format("dd MMM yyyy H:mm",$data->incharge_time);',
		),
		'subtask',
		array(
			'name'=>'create_time',
			'value'=>'Yii::app()->dateFormatter->format("dd MMM yyyy H:mm",$data->create_time);',
		),
	),
	'mergeColumns'=>array(
		'id',
		'tdescription',
		),
	),
)); ?>


in order to merge the 'id' column:

		array(
			'class'=>'CLinkColumn',
			'urlExpression'=>'Yii::app()->createUrl("task/view",array("id"=>$data->id));',
			'labelExpression'=>'$data->id',
		),


but, of course, it doesn't work.

Hope what I wrote above is quite clear.

Thanks for any help! :)
0

#4 User is offline   bennouna 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,166
  • Joined: 05-January 12
  • Location:Morocco

Posted 23 September 2012 - 02:27 PM

Hmm so I guess you're combining both Merge in 2 Columns and Extra Row

I think you need to specify 'name'=>'id' for you CLinkColumn…
0

#5 User is offline   The Dancing Lemur 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 21-September 12

Posted 24 September 2012 - 05:30 AM

View Postbennouna, on 23 September 2012 - 02:27 PM, said:

Hmm so I guess you're combining both Merge in 2 Columns and Extra Row

I think you need to specify 'name'=>'id' for you CLinkColumn…



Yes bennouna,
you're right I combined both of them.
I checked in Class Reference about a 'name' property for CLinkColumn but it's not available (trying to use it returns a missing property error).

I tried also to use the 'labelExpression' property to achieve it but it doesn't work at all..

I suppose the problem is caused by the css class assigned to CLinkColumn fields, that is "link-column" whereas the one needed to merge the columns seems to be "merge".

Any idea/help? :(
0

#6 User is offline   Odirlei 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 08-October 14

Posted 08 October 2014 - 09:16 AM

Hello, had the same problem with CButtonColumn. I decided to create a custom class:

<?php
class GroupButtonColumn extends CButtonColumn
{
        public $name, $value, $cssClassExpression='\'button-column\'';
}


My GroupGridView looked like this:

<?php $this->widget('ext.groupgridview.GroupGridView', array(
        ...
        'mergeColumns' => array('actions'),
        'mergeType' => 'nested',
        'columns' => array(
                array(                                
                                'class' => 'GroupButtonColumn', //replace CButtonColumn by GroupButtonColumn
                                'name' => 'actions', //I can now set the "name" property
                                'buttons' => array(
        ...


For those who have the same doubt.
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