過濾器的空行我已經設置了GridView控件crfeate我的表中Yii2.0如下:顯示在Yii2.0與GridView控件
<?= \yii\grid\GridView::widget([
'dataProvider' => $model->dataProvider,
'filterModel' => $model->searchModel,
'columns' => [
[
'label' => Yii::t($cat, 'Id'),
'value' => 'id',
],
[
'label' => Yii::t($cat, 'Title'),
'format' => 'raw',
'value' => function ($data) {
if ($data['status_code'] != 5)
{
return Html::a($data['title'], '/signer/view/' . $data['id']);
}
else
{
return $data['title'];
}
},
],
[
'label' => Yii::t($cat, 'Description'),
'value' => 'description',
],
[
'label' => Yii::t($cat, 'Filename'),
'value' => 'filename',
],
[
'label' => Yii::t($cat, 'Status'),
'value' => 'status',
'contentOptions' => function ($data) {
$statuses = [
1 => 'text-primary', # New
2 => 'text-warning', # Unsigned
3 => 'text-warning', # Partially signed
4 => 'text-success', # Signed
5 => 'text-danger', # Deleted
];
return [ 'class' => $statuses[$data['status_code']] ];
}
],
[
'label' => Yii::t($cat, 'Created'),
'value' => 'created',
],
//[ 'class' => 'yii\grid\ActionColumn' ],
],
]);
?>
我得到的所有正確的數據,而是過濾器的輸入,我得到空行。
這是爲什麼?我錯過了什麼?
PS:搜索模式本身工作正常,這意味着,當我添加到網址?title=asd
它實際上得到的搜索結果!
非常感謝。不知道我是如何錯過的。 – Peon 2014-12-18 12:23:56