Monday, December 22, 2014

Invisible/hide rows in CGridView rowCssClassExpression


$this->widget('zii.widgets.grid.CGridView', array(
 'id'=>'ordersort-grid',
 'dataProvider'=>$dataProvider,
 'rowCssClassExpression'=>'$data->dateleftint($data->order_id, $data->quantity, $data->order_date) >0?"row-open":"row-closed"',
    'htmlOptions'=>array(
  'class'=>'table table-striped table-hover table-bordered',
  ),
 'columns'=>array(
  'order_id',
  'name',
  'quantity',
  
   array(
      'header' => 'Day Left',
      'value'=>'$data->dateleft($data->order_id, $data->item_id, $data->quantity, $data->order_date)',        
      'type' => 'raw',
   'cssClassExpression' => '"foo" . (2+3) ."bar"', 
   
    ),
   

             array(
      'name'=>'employee_id',
      'header' => 'Employer',
      'value'=>'($data->employee_id=="")? "Not Selected" : $data->Employerr->company_name',        
      'type' => 'raw',
    ),
  'total',
  'paid',
  'due',
       
  'active',
  'paid_opt',
  'process_by',
  'process_date',
 
  array(
   'class'=>'CButtonColumn',
                         'template'=>'{process}',
                    'buttons'=>array
    (
        'process' => array
        (
            'label'=>'Post job/adv',
            'url'=>'Yii::app()->createUrl("order/jobpost", array("id"=>$data->id))',
  'visible'=>'$data->dateleftint($data->order_id, $data->quantity, $data->order_date) > 0 ? true : false;'
        ),
                        
),  ),
 ),
));

No comments:

Post a Comment