Yii:下拉小部件

时间:2015-09-16 06:55:32

标签: php yii widget

我正在尝试使用widget网络应用中的Yii创建下拉列表。这就是我在做的事情:

$this->widget('zii.widgets.grid.CGridView', array(
                        'id' => 'events-grid-future',
                        'filterPosition' => 'footer',
                        //'dataProvider' => $model->search('future'),
                        'dataProvider' => $model->search('future'),
                        'filter' => $model,
                        'ajaxUrl' => array('events/admin', 'search_all' => $search_all_value),
                        'itemsCssClass' => 'table table-hover table-striped table-bordered table-condensed',
                        'columns' => array(
                            array(
                                'name' => 'status',
                                'header' => 'Job Status',
                                'value' => 'ucfirst($data->status)',
                                'filter' => array('All' => 'All', 'Enquiry' => 'Enquiry', 'Contract Issued' => 'Contract Issued', 'Confirmed' => 'Confirmed', 'Hold' => 'Hold', 'Performed' => 'Performed'),
                            ),
),
)

但是下拉似乎是这样的:

enter image description here

null key为null value。我想删除它。有什么帮助吗?

1 个答案:

答案 0 :(得分:1)

尝试在过滤器中添加'empty' => '--- Select --- '

'filter' => array('All' => 'All', 'Enquiry' => 'Enquiry', 'Contract Issued' => 'Contract Issued', 'Confirmed' => 'Confirmed', 'Hold' => 'Hold', 'Performed' => 'Performed'),array('empty'=>'--- Select --- ')