gpt4 book ai didi

php - 数据表、Ajax 流水线

转载 作者:可可西里 更新时间:2023-11-01 13:27:02 27 4
gpt4 key购买 nike

我将数据表与 pipelining 一起使用.我工作得很好,除非我试图输入一个额外的列来保存“编辑”链接。参见 this表。

这是显示列的 server_processing.php 片段:

   /* 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 ]
});
});

那么,为什么这不起作用?

最佳答案

我自己也做过同样的事情。我喜欢使用 aoColumnDefs 配置我的所有列,因为您可以一次性为列添加多个配置选项。

// Disable sorting on the 3rd column
'aoColumnDefs': [{'aTargets': [2], 'bSortable': false}]

请注意,aTargets 是您要应用这些设置的列索引数组。因此,如果您要添加更多链接列(例如删除链接),您可以关闭对这些链接的排序,而无需每次都重写列定义。

// Disable sorting on the 3rd and 4th column
'aoColumnDefs': [{'aTargets': [2,3], 'bSortable': false}]

而且,正如我所说,您可以为同一数组中的列添加更多配置选项:

// Disable sorting on the 3rd and 4th column and sort 1st column by string
'aoColumnDefs': [
{'aTargets': [2,3], 'bSortable': false}
{'aTargets': [0], 'sType': 'string'}
]

关于php - 数据表、Ajax 流水线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6670443/

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