为了从Datatables实例中删除选定的行,我可以使用:
var rows = table
.rows( '.selected' )
.remove()
.draw();
但是,我还想向用户显示一条警告消息,如下所示:
var rows = table
.rows( '.selected' )
.showWarning('Are you sure you want to delete the selected rows?')
.remove()
.draw();
如何在删除行之前向用户显示警告?
答案 0 :(得分:2)
您可以使用confirm()
,如下所示:
if(confirm('Are you sure you want to delete the selected rows?')){
var rows = table
.rows( '.selected' )
.remove()
.draw();
}