Answer the question
In order to leave comments, you need to log in
Problems in Yii2 GridView?
I need that in the profile of applications (cargo transportation) you can in the driver field, click on the button and a modal window opens with a list of the driver, where you could select the driver.
I just made a modal window in which the page with the GridView is rendered and there is already a list of the driver, but I don’t understand how to assign this driver to the application.
Here is what I wrote:
task/_form.php
Modal::begin(
[
'id' => 'modal',
'size' => 'modal-lg',
'header' => 'Выбор водителя',
'toggleButton' => [
'label' => 'Выбор',
'options' => ['class' => 'btn btn-danger'],
],
]
);
echo $this->render('chooseDriver', ['task' => $model]);
Modal::end();
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
[
'attribute' => 'id',
'value' => function ($modal) {
return '#'. $modal->id;
},
],
'name',
'car',
'gov',
'rights',
[
'attribute' => 'id',
'label' => 'Выбрать водителя',
'format' => 'html',
'filter' => false,
'value' => function ($model) {
$value = '<a href="driverChoose?id=' . $model->id . ' " class="btn btn-danger">Выбрать</a>';
return $value;
}
]
],
]); ?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question