gpt4 book ai didi

javascript - 无法使用 columnFilter 重新初始化 DataTable 错误

转载 作者:行者123 更新时间:2023-11-28 07:13:04 29 4
gpt4 key购买 nike

我正在尝试将 Columnfilter 添加到这段代码中:

$(document).ready(function() {
var table = $('#sampleOrderTable').DataTable( {
dom: 'T<"clear">lfrtip',
processing: true,
serverSide: false,
ajax: {
"url": '<?php echo base_url(); ?>welcome/datatable',
"type": "POST"

},
"tableTools": {
"sSwfPath": '<?php echo base_url(); ?>assets/DataTables-1.10.4/extensions/TableTools/swf/copy_csv_xls_pdf.swf'
},
"columns": [
{
"className": 'details-control',
"orderable": false,
"data": null,
"defaultContent": ''
},
{ "data": "RES_ID" },
{ "data": "PROP_NAME" },
{ "data": "RES_STATUS" },
{ "data": "RES_CHECK_IN" },
{ "data": "RES_CHECK_OUT" },
{ "data": "RES_N_ADULTS" },
{ "data": "RES_GUEST_FIRSTNAME" },
{ "data": "RES_GUEST_LASTNAME" },
{ "data": "BOOKING_SOURCE_LABEL" },
{ "data": "DATE_ADDED" },
{ "data": "IS_TRANSFER" },
{ "data": "IS_ARRIVED" },
],
"order": [[1, 'asc']]

});
$('#sampleOrderTable').dataTable({
"bProcessing": true,
}).columnFilter({
aoColumns: [
{ type: "text" },
{ type: "text" },
{ type: "text" },
{ type: "text" },
{ type: "date" },
{ type: "text" },
{ type: "text" },
{ type: "text" },
{ type: "text" },
{ type: "text" },
{ type: "text" },
{ type: "text" },
{ type: "text" },
]
});

尝试在第一个数据表末尾之前添加列过滤器,但一遍又一遍地出现此错误..有人知道那里出了什么问题吗?无法重新初始化数据表错误

我尝试这样做:

$(document).ready(function() {
var table = $('#sampleOrderTable').DataTable( {
dom: 'T<"clear">lfrtip',
processing: true,
serverSide: false,
ajax: {
"url": '<?php echo base_url(); ?>welcome/datatable',
"type": "POST"

},
"tableTools": {
"sSwfPath": '<?php echo base_url(); ?>assets/DataTables-1.10.4/extensions/TableTools/swf/copy_csv_xls_pdf.swf'
},
"columns": [
{
"className": 'details-control',
"orderable": false,
"data": null,
"defaultContent": ''
},
{ "data": "RES_ID" },
{ "data": "PROP_NAME" },
{ "data": "RES_STATUS" },
{ "data": "RES_CHECK_IN" },
{ "data": "RES_CHECK_OUT" },
{ "data": "RES_N_ADULTS" },
{ "data": "RES_GUEST_FIRSTNAME" },
{ "data": "RES_GUEST_LASTNAME" },
{ "data": "BOOKING_SOURCE_LABEL" },
{ "data": "DATE_ADDED" },
{ "data": "IS_TRANSFER" },
{ "data": "IS_ARRIVED" },
],
"order": [[1, 'asc']]

.columnFilter({
aoColumns: [
{ type: "text" },
{ type: "text" },
{ type: "text" },
{ type: "text" },
{ type: "date" },
{ type: "text" },
{ type: "text" },
{ type: "text" },
{ type: "text" },
{ type: "text" },
{ type: "text" },
{ type: "text" },
{ type: "text" },

]

});

});

但是页面上没有任何反应..

最佳答案

尝试执行以下操作:

$(document).ready(function () {
var table = $('#sampleOrderTable').DataTable({
dom: 'T<"clear">lfrtip',
processing: true,
serverSide: false,
ajax: {
"url": '<?php echo base_url(); ?>welcome/datatable',
"type": "POST"

},
"tableTools": {
"sSwfPath": '<?php echo base_url(); ?>assets/DataTables-1.10.4/extensions/TableTools/swf/copy_csv_xls_pdf.swf'
},
"columns": [
{
"className": 'details-control',
"orderable": false,
"data": null,
"defaultContent": ''
},
{"data": "RES_ID"},
{"data": "PROP_NAME"},
{"data": "RES_STATUS"},
{"data": "RES_CHECK_IN"},
{"data": "RES_CHECK_OUT"},
{"data": "RES_N_ADULTS"},
{"data": "RES_GUEST_FIRSTNAME"},
{"data": "RES_GUEST_LASTNAME"},
{"data": "BOOKING_SOURCE_LABEL"},
{"data": "DATE_ADDED"},
{"data": "IS_TRANSFER"},
{"data": "IS_ARRIVED"}
],
"order": [[1, 'asc']]
}).columnFilter({
aoColumns: [
{type: "text"},
{type: "text"},
{type: "text"},
{type: "text"},
{type: "date"},
{type: "text"},
{type: "text"},
{type: "text"},
{type: "text"},
{type: "text"},
{type: "text"},
{type: "text"},
{type: "text"}

]

});

});

关于javascript - 无法使用 columnFilter 重新初始化 DataTable 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31116988/

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