I have set up this within the grid widget -
[‘class’ => ‘yii\grid\ActionColumn’,
'template' => '{view} {update} {delete}',
'buttons' => [
'view' => function ($url, $model) {
return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', $url, [
'id' => 'view-link',
'title' => Yii::t('yii', 'View'),
'data-toggle' => 'modal',
'data-target' => '#activity-modal',
'data-pjax' => '1',
]);
},
],
],
],
]);
Pjax::end();
Then below on the same view page I have the Modal -
Modal::begin([
'id' => 'activity-modal',
'header' => '<h2>Hello world</h2>',
//'toggleButton' => ['label' => 'click me'],
]);
echo ‘hi’;
Modal::end();
How can I pass the data to the modal to display the data in more detail, or even make it populate a form so that the data can be edited.
Also in the return Html:: part the $url is passed to it, but with this there the modal pops up quickly and then the page is redirected to that url, so I have removed that to prevent it from happening.
Many Thanks
Matt