我试图使用ajax将多个列传递给php文件我希望在一个数据单元格中显示多个列。
这是适用于一个colunm的代码
<script type="text/javascript">
$(document).ready(function () {
$('#datatable-responsive').DataTable({
"columns": [
{"data": "fname"},
{"data": "phoneno"},
{"data": "email"},
{"data": "idno"},
{"data": "idno"},
{"data": "status"}
],
"processing": true,
"fixedHeader": true,
"serverSide": true,
"ajax": {
url: '../lib/request/viewrequests.php',
type: 'POST'
}
});
});
</script>
如何更改上述内容以传递{"data": ""}
答案 0 :(得分:2)
使用columns.render
选项定义渲染功能。
例如:
"columns": [
{"data": "fname"},
{"data": "phoneno"},
{"data": "email"},
{"data": "idno"},
{"data": "status"},
{
"data": null,
"render": function(data, type, full, meta){
return full["idno"] + ", " + full["status"];
}
}
],