I copy the code from CGridView to QGridView.
I just add :
Yii::import('zii.widgets.grid.CGridView');
and to test :
foreach($this->columns as $i=>$column)
{
if(is_string($column))
$column=$this->createDataColumn($column);
else
{
if(!isset($column['class'])){
echo '<pre>';
print_r($column['class']);
echo '</pre>';
exit();
$column['class']='CDataColumn';
}
$column=Yii::createComponent($column, $this);
}
I get this error :
aand here the call to the widget :
$this->widget('application.extensions.core.QGridView', array(// application.extensions.core.GroupGridView // zii.widgets.grid.CGridView
'id' => 'tprojets-grid',
'dataProvider' => $model->search(),
// 'extraRowColumns' => Yii::app()->user->isAdmin ?array('date'):'',
'enablePagination' => true,
// 'add' => true,
'columns' => array(
// array(
// 'class' => 'ECheckBoxColumn',
// 'id' => 'ckPourEnvoyer',
// 'header' => 'c',
// 'disabled' => 'helpers::setCkPourEnvoyer($data->factured,$data->fk_personne)? null : "disabled"',
// 'cssClassExpression' => "(\$data->factured) ? 'tdred':''",
// 'value' => '$data->rapport_activite_id',
// 'selectableRows' => 2,
// ),
array(
'name' => 'date',
'value' => '$data->date',
'htmlOptions' => array('style' => 'text-align: center;width:100px'),
'cssClassExpression' => "(\$data->factured) ? 'tdred':''",
),
array(
// 'class' => 'TotalColumn', //'heures', //'footer'=>$provider->itemCount===0 ? '' : $model->getTotals(),
'name' => 'heures',
'value' => '$data->heures',
'type' => 'raw',
'htmlOptions' => array('style' => 'text-align: center;width:50px'),
'footer' => true,
),
array(
'name' => 'libelle_public',
'value' => '$data->libelle_public',
'htmlOptions' => array('style' => 'width:550px'),
),
array(
'name' => 'projetsActif',
'value' => '$data->projetsActif->acronyme',
'header' => 'Projets',
),
array(
'name' => 'tachesActif',
'value' => '$data->tachesActif->titre',
'header' => 'Taches',
),
array(
'name' => 'facture',
'type' => 'html',
'value' => '$data->facture ? CHtml::image(helpers::evaluateTrick($data->facture)): "" ',
'htmlOptions' => array('style' => 'text-align: center;width:25px'),
'header' => 'Facturable',
),
array(
'name' => 'fk_personne',
'value' => '$data->personnesActif->NomPersonne',
'htmlOptions' => array('style' => 'width:125px'),
'header' => 'Personnes',
),
// array(
// 'class' => 'QButtonColumn',
// 'template' => '{update}{delete}',
// 'deleteButtonUrl' => 'Yii::app()->createUrl("/TRapportsActivites/delete", array("id" => $data->rapport_activite_id))',
// 'buttons' => array(
// 'update' => array(
// 'visible' => 'helpers::autoriseAction($data->fk_personne) ? true : false',
// 'url' => '$this->grid->controller->createUrl("/TRapportsActivites/update", array("id"=>$data->rapport_activite_id,"asDialog"=>1,"gridId"=>$this->grid->id))',
// 'click' => 'function(){$("#frame-Update").attr("src",$(this).attr("href")); $("#form-Update").dialog("open"); return false;}',
// ),
// 'delete' => array(
// 'visible' => 'helpers::autoriseAction($data->fk_personne) ? true : false',
// ),
// ),
// ),
),
));
if I replace application.extensions.core.QGridView with zii.widgets.grid.CGridView, it’is working !