我需要在网格中打开一个模态按钮,但是不能正常工作
这是专栏:
['class' => 'yii\grid\ActionColumn',
'template' => '{getRespostaPossivel}',
'buttons' => [
'getRespostaPossivel' => function ($url, $model) {
if($model->classeResposta->indr_resposta_possivel){
return Html::buttonInput('Respostas Possíveis',['class'=>'btn btn-primary btn-xs','id' => 'modal-open','onclick' =>
"$('#modal').modal('show');
$.ajax({
url : 'getFormRespostaPossivel',
data : {'id' : $model->id},
success : function(data) {
$('.modal-body').html(data);
}
});
"]);
}
},
],
],
和行动:
public function actionGetFormRespostaPossivel($id)
{
$searchModel = new RespostaPossivelUsuarioSearch();
$searchModel->tblcaus_id = $id;
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('_form', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider
],true,true);
}
有人可以帮我解决这个问题吗?