我的索引中有一个DataTable,其中的行使用JavaScript加载。编辑,详细信息,删除和历史记录按钮一起创建。所有这些都在模态窗口中打开(模态块在索引内)...在每个按钮的html中有一个"数据模式"该属性,它将作为onclick事件的参考,该事件将导致该按钮在Modal窗口中打开。
"columns": [
{ "data": "id", "name": "Id", "autoWidth": true },
{ "data": "descricao", "name": "Descricao", "autoWidth": true },
{ "data": "pessoaTipoDescricao", "name": "PessoaTipo", "autoWidth": true },
{
"render": function (data, type, full, meta) {
return '<a btnEditar title="Editar" data-modal="" href="/situacoes-gerenciamento/editar-situacao/' + full.id + '" class="btn btn-sm btn-icon btn-pure btn-default on-default edit-row"><span class="icon-2x wb-edit"></span></a> |' +
'<a title="Detalhes" data-modal="" href="/situacoes-gerenciamento/situacao-detalhes/' + full.id + '" class="btn btn-sm btn-icon btn-pure btn-default on-default footable-row-detail-row"><span class="icon-2x wb-search"></span></a> |' +
'<a title="Excluir" asp-action="Delete" data-modal="" class="btn btn-sm btn-icon btn-pure btn-default on-default remove-row"><span class="icon-2x wb-trash"></span></a> |' +
'<a title="Histórico" class="btn btn-sm btn-icon btn-pure btn-default on-default clockpicker" data-toggle="modal" data-target="#pessoaHistory" data-original-title="Histórico"><span class="icon-2x wb-time"></span></a>'
}
}
],
&#13;
问题:点击&#34;编辑&#34;按钮,&#34;数据模型&#34;似乎无法识别属性且onclick事件无效:
$('a[data-modal]').on('click', function (e) {
// Abre a janela modal com o formulário solicitado
openmodal(this.href);
return false;
});
&#13;
有人知道如何解决这个问题吗?