0
私はindex.phpを変更してidの代わりに名前を表示しました。YII2 - index.phpの列フィルタは機能しません
これは私の注文/
<?php
use yii\helpers\Html;
use yii\grid\GridView;
use yii\widgets\Pjax;
use yii\helpers\ArrayHelper;
use frontend\models\Statuses;
$this->title = Yii::t('app', 'Ordini');
$this->params['breadcrumbs'][] = $this->title;
$user = Yii::$app->user->identity;
?>
<div class="orders-index">
<h1><?= Html::encode($this->title) ?></h1>
<p>
<?php
if ($user->role == 10 || $user->role > 40)
echo Html::a(Yii::t('app', 'Nuovo'), ['create'], ['class' => 'btn btn-success']);
?>
</p>
<?php Pjax::begin(); ?>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
['attribute'=>'customer_id', 'value'=>'CustomersName',],
['attribute'=>'product_id', 'value'=>'ProductsName',],
'date',
[
'attribute'=>'status_id',
'value'=>'StatusesName',
'filter' => Html::activeDropDownList($searchModel, 'status_id', ArrayHelper::map(Statuses::find()->asArray()->all(), 'id', 'name'),['class'=>'form-control','prompt' => 'Select Category']),
],
['class' => 'yii\grid\ActionColumn'],
],
]); ?>
<?php Pjax::end(); ?></div>
フィルターが動作しませんindex.phpのです。私はドロップダウンで試してみました。 どこが失敗するかを確認する方法がわかりません!
OrdersSearch?モデルやコントローラーで?
ありがとうございました
フィルターは機能しませんでした – GMazzacua
質問に '$ searchModel'の後ろにあるクラスのコードを追加してください。 – Bizley
OrdersSearch?ここでは、http://pastebin.com/VLLzXf8cとここでordersearch http://pastebin.com/pSd64qmC – GMazzacua