YII CGRIDVIEW drop down filter

 <?php  
$this->widget('zii.widgets.grid.CGridView', array(
'itemsCssClass' => 'table table-hover table-striped table-bordered table-condensed',
'id' => 'orders-grid',
'dataProvider' => $model->search(),
'filter' => $model,
'columns' => array(
'order_id',
'user_id',
array(
'header' => 'Product Name (QTY)',
'value' => 'OcProductDescription::model()->order_products("$data->offer_ids")',
),
'offer_ids',
'order_total',
'order_status',
'payment_status',  
// this code below is used to create drop down filter
array(
'name' => 'affiliate',
'value' => 'Orders::model()->getAffiliateValue($data->affiliate)',
'filter' => array(
'1' => 'ΓΑΙΤΑΝΗΣ ΒΑΣΙΛΕΙΟΣ',
'2' => 'ΘΕΟΔΩΡΟΣ ΚΑΜΠΟΛΗΣ',
'3' => 'ΑΘΗΝΑ ΦΡΑΓΚΟΥ',
)
),
'order_date',
array(
'class' => 'CButtonColumn',
),
),
));
?>

Leave a comment

Your email address will not be published. Required fields are marked *