luc
(Luc Pfister)
February 14, 2012, 6:59pm
1
Hi,
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
luc
(Luc Pfister)
February 14, 2012, 7:29pm
2
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
luc
(Luc Pfister)
February 17, 2012, 12:26pm
3
Ok,
I’m trying to extend CGridColumn, as seen in some extensions: example
My code:
<?php
Yii::import('zii.widgets.grid.CGridColumn');
class LTestColumn extends CGridColumn
{
protected function renderDataCellContent($row,$data)
{
echo "toto";
}
}
Quiet simple
In my view:
<?php Yii::import('ext.LTestColumn'); ?>
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'vol-grid',
'dataProvider'=>$model->search(),
'htmlOptions'=>array('class'=>'table table-striped table-condensed'),
'pagerCssClass'=>'pagination',
'pager'=>array('htmlOptions'=>array('class'=>'')),
'filter'=>$model,
'summaryText'=>'',
'columns'=>array(
//some colums
array(
'class'=>'LTestColumn',
),
//etc
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 …
luc
(Luc Pfister)
February 17, 2012, 4:33pm
4
Note that EImageColumn gives me a blank page too
luc
(Luc Pfister)
February 17, 2012, 6:34pm
5
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