I am newbie to YII. This is my CgridView. The function (TblPaid::model()->alreadyPaidUpto(arg1,arg2)) called three times in adjacent columns of same CgidView. I want to call the funtion once and reuse the result in other two columns. Could someone please give me a hint?, Thanks.
$this->widget(‘SpecialGridView’, array(
'id'=>'tbl-deposit-grid',
'dataProvider'=>$model->balanceSearch($dateReport,$category,$officeID),
'extraparam'=> $dateReport,
//'filter'=>$model,
'columns'=>array(
//'category',
array('name'=>'category', 'headerHtmlOptions'=>array('width'=>'50px')),
//'account',
array('name'=>'account', 'headerHtmlOptions'=>array('width'=>'120px')),
//'officeID',
array('name'=>'officeID', 'header'=>'Office', 'type'=>'raw', 'value'=>'(empty($data->office))? $data->officeID: $data->office->office','headerHtmlOptions'=>array('width'=>'120px')),
//'receiptNo',
array('name'=>'id', 'headerHtmlOptions'=>array('width'=>'90px')),
//'dateReceived',
array('name'=>'dateReceived', 'headerHtmlOptions'=>array('width'=>'70px')),
//'amount',
array(
'name'=>'amount','headerHtmlOptions'=>array('width'=>'80px'),
'value'=>'number_format($data->amount,2)', 'htmlOptions'=>array('style'=>'text-align: right'),
),
array('name'=>'Paid upto this Date',
'value'=>'number_format((TblPaid::model()->alreadyPaidUpto($data->id, $this->grid->extraparam)),2)','htmlOptions'=>array('style'=>'text-align: right'),
),
array('name'=>'Balance',
'value'=>'number_format($data->amount-(TblPaid::model()->alreadyPaidUpto($data->id, $this->grid->extraparam)),2)','htmlOptions'=>array('style'=>'text-align: right'),
),
//
array(
'header'=>'Running Balance',
'class'=>'RunningTotalColumn',
'value'=>'$data->amount-(TblPaid::model()->alreadyPaidUpto($data->id, $this->grid->extraparam))',
'htmlOptions'=>array('style'=>'text-align: right'),
),
//'receivedBy',
array('name'=>'receivedBy', 'headerHtmlOptions'=>array('width'=>'200px')),
//'type',
array('name'=>'type', 'headerHtmlOptions'=>array('width'=>'80px')),
//'comment',
//array('name'=>'comment', 'headerHtmlOptions'=>array('width'=>'110px')),
),
));