yii2过滤griview标签值

时间:2019-07-05 14:07:50

标签: yii2

我有一个带有标签的yii2 gridview,我想在标签值上为其添加一个过滤器,如下所示: enter image description here

这是我的代码:

[
        'label'=>'Acties',
        'mergeHeader'=>true,
        'hAlign'=>'center',
        'vAlign'=>'middle',
        'width' => '5%',
        'format' => 'raw',
        'value' => function($model){
            $a = Yii::$app->appSettings->RontgenAfdelingId();
            if ($model->locatie_id) {
                return $model->user_id ?
                    ($model->afgehandeld ?
                        (
                            \app\models\Factuur::find()
                                ->where(['patient_id'=>$model->patient_id,'bezoek_id'=>$model->patientBezoeks->id, 'betaald' => null])
                                ->one()?
                                Html::a('Betalen', ['factuur-betalen', 'wachtkamer_id' => $model->id, 'patient_id' => $model->patient_id], ['role' => 'modal-remote', 'class' => 'btn btn-danger btn-xs', 'data-pjax' => 0]):
                                Html::a('Betaald', ['factuur-betalen', 'wachtkamer_id' => $model->id, 'patient_id' => $model->patient_id], ['role' => 'modal-remote', 'class' => 'btn btn-success btn-xs', 'data-pjax' => 0])
                        )
                        :
                        ($model->afdeling_id == $a?
                            Html::a('Rontgen maken',['/patient/view', 'id' => $model->patient_id, 'wachtkamer_id' => $model->id],['class' => 'btn btn-danger btn-xs', 'data-pjax' => 0])
                            :
                            ($model->user_id != Yii::$app->user->id ? 'In-Behandeing' :
                                Html::a('In behandeling', ['/patient/view', 'id' => $model->patient_id, 'wachtkamer_id' => $model->id], ['class' => 'btn btn-danger btn-xs', 'data-pjax' => 0]))))
                    :
                    ($model->afdeling_id == $a?Html::a('Select-Rontgen', ['rontgen-verrichting','wachtkamer_id' => $model->id, 'patient_id' => $model->patient_id], ['role' => 'modal-remote', 'class' => 'btn btn-primary btn-xs'])
                        :
                        Html::a('Behandelen', 'javascript:', ['onclick' => 'behandelen(' . $model->id . ',' . $model->patient_id . ')', 'class' => 'btn btn-primary btn-xs']));
            }else
                return '<span class="glyphicon glyphicon-arrow-left"></span>&nbsp;&nbsp;Zet&nbsp;locatie';
        },
    ],

标签值过滤器

0 个答案:

没有答案