gpt4 book ai didi

jquery datatable(TableTool)自定义按钮调用事件

转载 作者:行者123 更新时间:2023-12-01 01:34:35 26 4
gpt4 key购买 nike

可以使用 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');
}

}
]
}

最佳答案

在对 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');
}

}
]
}

关于jquery datatable(TableTool)自定义按钮调用事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18134913/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com