Minggu, 19 Maret 2017

Cgridview

Model
public function statusBarang($i)
 {
  if($i==1)
   return "Belum diproses";
  else if($i==2)
   return "Sedang diproses";
  else 
   return "Sudah diproses";
 }
Controller
$this->widget('zii.widgets.grid.CGridView', array(
 'id'=>'junction-tab-grid',
 'dataProvider'=>$model->search(),
 'columns'=>array(
  'id',
  'kodeBarang',
  array(
   'name'=>'Nama Mahasiswa',
   'type'=>'raw',
   'value'=>'Barang::model()->statusBarang($data->statusBarang)',
  ),
  array(
   'class'=>'CButtonColumn',
  ),
 ),
));

0 komentar:

Posting Komentar