有没有办法停止显示移除确认模式?
我有:
table.DataTable({
dom: "Bfrtip",
ajax: routes['customers.fetch'],
order: [[1, 'desc']],
language: global.config.config.dataTables.language,
aoColumnDefs: [
{ targets: [7, 9], visible: false},
{ targets: [6], iDataSort: 7},
{ targets: [8], iDataSort: 9},
],
columns: [
{
data: null,
defaultContent: '',
className: 'select-checkbox',
orderable: false
},
{ data: "id" },
{ data: "name" },
{ data: "email" },
{ data: "tel" },
{ data: "agent" },
{ data: "created_at", 'type': 'date', "dateFormat": "yy-mm-dd"},
{ data: "created_at" },
{ data: "last_order" },
{ data: "last_order_sort" },
{ data: "ltv", render: $.fn.dataTable.render.number( ',', '.', 0, '$' ) }
],
select: {
style: 'os',
selector: 'td:first-child'
},
buttons: [
{ extend: "create", editor: editor },
{ extend: "edit", editor: editor },
{ extend: "remove", editor: editor}
]
});
答案 0 :(得分:0)
最后我只创建了自己的自定义删除功能:
buttons: [
...
{
text: 'Delete',
action: function (e, dt, node, config) {
var selected = [];
$('tbody', $table).find('tr.selected').each(function(i, v){
selected.push($(v).attr('id').substr(4));
$(v).css('opacity', 0.2);
});
if(selected.length > 0) {
qwest.delete(routes['customers.delete'], {_token: $table.data('csrf'), selected: selected})
.then(function (xhr) {
$('#crm_table').DataTable().ajax.reload(null, false);
})
.catch(function(e){
modal('error', {msg: e.response});
$('tbody', $table).find('tr.selected').css('opacity', 1);
$('#crm_table tr').removeClass('selected');
})
}
}
}
]