【发布时间】:2011-10-03 23:14:27
【问题描述】:
我正在使用带有 pipelining 的 DataTables。我工作得很好,除非我尝试输入一个额外的列来保存“编辑”链接。请参阅this 表。
这是 server_processing.php 的 sn-p 显示列:
/* Array of database columns which should be read and sent back to DataTables.
* Use a space where you want to insert a
* non-database field (for example a counter or static image)
*/
$aColumns = array( 'user','email', );
这里是客户端:
$(document).ready( function (){
$('#example').dataTable({
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "scripts/server_processing.php",
"fnServerData": fnDataTablesPipeline,
aoColumns: [null, null, {"bSortable": false}]
}).makeEditable({
sUpdateURL: "UpdateData.php",
sAddURL: "AddData.php",
sAddHttpMethod: "POST",
sDeleteURL: "DeleteData.php",
sDeleteHttpMethod: "POST",
aoColumns: [ { } , { } , null ]
});
});
那么,为什么这不起作用?
【问题讨论】:
-
我对 DataTables 的体验不包括使用流水线,但是在添加“虚拟列”时 - 例如,编辑列、复选框、计算行,通常您需要为其添加占位符你的
aoColumns数组。所以我会将aoColumns: [null, null, {"bSortable": false}]aoColumns: [null, null, {"bSortable": false}] 更改为aoColumns: [null, null, null, {"bSortable": false}] -
另外,如果您有任何问题,编写 dataTables 的人(我认为是 Alan Jardine?)非常善于提供帮助。他非常乐于助人,显然没有人比创作者本人更了解插件!
标签: php javascript jquery ajax datatables