How To Merge Clinkcolumn In Groupgridview

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!

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! :)

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

I think you need to specify [font=“Courier New”]‘name’=>‘id’[/font] 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? :(

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.