How to extend CButtonColumn


I need to extend CButtonColumn to show a dropdown list. While changing the option with this dropdown, I want to call a specific controller action and update the grid via ajax.

I had a look at the CButtonColumn class, and I think it should not be to difficult to write a function, saying "renderDropdown", like "renderButton" in CButtonColumn class.

My questions:

1/ where to put this ? in components, in extensions ?

2/ should this extend directly from CButtonColumn or from parent CGridColumn ?

Any guidance will be highly appreciate.

btw: I’m at the bottom of the php learning curve ;D

My question is very similar to that one

Good to know that it is possible(same thread)

But I’m a bit like sonam in the fourth post :slight_smile:


I’m trying to extend CGridColumn, as seen in some extensions: example

My code:



class LTestColumn extends CGridColumn


  protected function renderDataCellContent($row,$data)


	echo "toto";



Quiet simple :wink:

In my view:

<?php  Yii::import('ext.LTestColumn'); ?>

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



	'htmlOptions'=>array('class'=>'table table-striped table-condensed'),






//some colums





I’ve got a blank page with no errors … (I’ve tried also to call parent::init() before, but same result.

Commenting the array with my customized (!) class render the grid correctly …

Note that EImageColumn gives me a blank page too

I’ve just installed php-console:

unexpected T_STRING, expecting T_FUNCTION [/www/planches/protected/extensions/EImageColumn.php:20]

Same kind of error with my simple LTestColumn class.

I’ve changed my editor’s settings and it goes better.

An afternoon long for solving this stupid problem :-X