I have an annoying problem with CGridView in that it won’t accept my custom name for the field header. In the example below I am trying to have the column header print ‘Is paid’. However this is causing an exception with the message ‘Is paid’ is not defined. If I change it back to the MySQL column name ‘expensePaid’ it works OK.
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'expense-grid',
'dataProvider'=>$model->search(),
'filter'=>$model,
'columns'=>array(
'id',
'creditor.name',
'expenseName',
'expenseTotal',
'expensePaid',
array('name'=>'Is paid', 'value'=>'Expense::getStatusText($data["expensePaid"])'),
'expensePaidDate',
array(
'class'=>'CButtonColumn',
),
),
)); ?>
I have used this is the past and it’s work as expected. Is there cases where this approach will not work?
This is with Yii version 1.1.10.