我正在尝试使用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'),
),
),
)
但是下拉似乎是这样的:
null key
为null value
。我想删除它。有什么帮助吗?
答案 0 :(得分:1)
尝试在过滤器中添加'empty' => '--- Select --- '
:
'filter' => array('All' => 'All', 'Enquiry' => 'Enquiry', 'Contract Issued' => 'Contract Issued', 'Confirmed' => 'Confirmed', 'Hold' => 'Hold', 'Performed' => 'Performed'),array('empty'=>'--- Select --- ')