问题
my code in cgridview
enter cod<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'party-ledger-grid',
'dataProvider'=>$model->search(),
'columns'=>array(
'id',
array(
'name'=>'trans_date',
'value'=> 'Yii::app()->dateFormatter->format("d-MMM-y",strtotime($data->trans_date))'
),
'trans_id',
array(
'name'=>'tr_type_id',
'value'=>'$data->trType->tr_code'
),
.....
and result shown below:
My question is how to insert first static row in cgridview table after header, for previous balance. how to add static custom row in cgridview.
回答1:
Actually you can't do this in simple way. There are 2 options:
Generating row in javascript and appending it to table.
using CArrayDataProvider instead of CAtiveDataProvider and appending to it first row that you will calculate. This method has more shortcomings.
I used first method when i faced this problem.
来源:https://stackoverflow.com/questions/19182182/insert-static-first-row-in-cgridview-yii