我在gridview中有这段代码
....
[
'label'=>'Read',
'format' => 'html',
'value'=>function ($data) {
return Html::a('Read',Url::to(['readmessage/read/','q'=>$data->message_id]), ['data' => ['confirm' => 'My confirm question here?']]);
},
],
....
但是上面的代码并没有在锚链接中生成数据确认选项,我尝试[data-confirm => 'My confirm question here?']
也没有工作。
我的代码出了什么问题?
答案 0 :(得分:0)
将格式更改为“原始”:
[
'label'=>'Read',
'format' => 'raw',
'value'=>function ($data) {
return Html::a('Read',Url::to(['readmessage/read/','q'=>$data->message_id]), ['data' => ['confirm' => 'My confirm question here?']]);
},
],
答案 1 :(得分:0)
只需使用“数据确认”
[
'label'=>'Read',
'format' => 'html',
'value'=>function ($data) {
return Html::a('Read',Url::to(['readmessage/read/','q'=>$data->message_id]), ['data-confirm' => 'My confirm question here?']);
},
],