可以使用TableTool在Jquery数据表中使用自定义按钮来保存,编辑或删除数据等自定义事件。我真的不明白如何覆盖集成按钮
var oTable = $('#unis').dataTable({
//"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "index.php?...&<?php echo JSession::getFormToken() . '=1' ?>",
"sDom": "<'row-fluid'<'span6'T><'span6'f>r>t<'row-fluid'<'span6'l><'span6'p>>",
"sPaginationType": "bootstrap",
"aoColumns":[
{"bSortable": false},
{"bSortable": false},
{"bSortable": true},
{"bSortable": true},
{"bSortable": false},
],
"oTableTools": {
"aButtons": [ "delete selected", "export" ]
}
});
发现它!
我必须使用sExtends
"oTableTools": {
"sRowSelect": "multi",
"aButtons": [
{"sExtends": "new_record","sButtonText": "Add"},
{"sExtends": "select","sButtonText": "Delete Recods",
"fnClick": function (nButton, oConfig, oFlash) {
//delete stuff comes here
alert('test');
}
}
]
}
答案 0 :(得分:1)
在Datatables API中进行研究后,我找到了一个使用sExtends的解决方法,你可以扩展按钮功能并添加你的
"oTableTools": {
"sRowSelect": "multi",
"aButtons": [
{"sExtends": "new_record","sButtonText": "Add"},
{"sExtends": "select","sButtonText": "Delete Recods",
"fnClick": function (nButton, oConfig, oFlash) {
//delete stuff comes here
alert('test');
}
}
]
}