DataTables.net 从 CSV 导出中删除双引号
DataTables.net remove double quotes from CSV export
我正在使用 datatables.net 从 table 导出 csv 文件,如下所示:
var buttonCommon = {
exportOptions: {
format: {
body: function (data, row, column, node) {
return data.replace("\"", "");
}
}
}
};
<%--Data tables--%>
var table = $('.table').DataTable({
"paging": false,
"ordering": false,
"info": false,
"searching": false,
bSortCellsTop: false,
dom: 'Bfrtip',
buttons: [
$.extend(true, {}, buttonCommon, {
extend: 'csvHtml5'
})
]
});
这应该会产生一个没有双引号的 csv 文件,但它们出现了....
我已经看过了,但找不到任何人 运行 解决这个问题?知道我做错了什么吗?
"Receipt","Total","Date","","","","Total","Type","GL Code","Amount","","",""
"g092920","","09/29/2020","","","","","","106.104.0000",".52","","",""
"","","","","","","","","106.369.0009","[=12=].00","","",""
"g092920","","09/29/2020","","","","","","","[=12=].00","","",""
"g092920","","09/29/2020","","","","","","106.208.1000",".45","","",""
"g092920","","09/29/2020","","","","","","106.347.2040",".07","","",""
"g092920","","09/29/2020","","","","","","106.347.2050","[=12=].00","","",""
"g092920","","09/29/2020","","","","","","106.347.2050",".00","","",""
这就是停止在字符串周围使用双引号所需的全部内容,请注意 fieldBoundary 选项:
var table = $('.table').DataTable({
"paging": false,
"ordering": false,
"info": false,
"searching": false,
bSortCellsTop: false,
dom: 'Bfrtip',
buttons: [
$.extend(true, {}, buttonCommon, {
extend: 'csvHtml5',
fieldBoundary: ''
})
]
});
我正在使用 datatables.net 从 table 导出 csv 文件,如下所示:
var buttonCommon = {
exportOptions: {
format: {
body: function (data, row, column, node) {
return data.replace("\"", "");
}
}
}
};
<%--Data tables--%>
var table = $('.table').DataTable({
"paging": false,
"ordering": false,
"info": false,
"searching": false,
bSortCellsTop: false,
dom: 'Bfrtip',
buttons: [
$.extend(true, {}, buttonCommon, {
extend: 'csvHtml5'
})
]
});
这应该会产生一个没有双引号的 csv 文件,但它们出现了.... 我已经看过了,但找不到任何人 运行 解决这个问题?知道我做错了什么吗?
"Receipt","Total","Date","","","","Total","Type","GL Code","Amount","","",""
"g092920","","09/29/2020","","","","","","106.104.0000",".52","","",""
"","","","","","","","","106.369.0009","[=12=].00","","",""
"g092920","","09/29/2020","","","","","","","[=12=].00","","",""
"g092920","","09/29/2020","","","","","","106.208.1000",".45","","",""
"g092920","","09/29/2020","","","","","","106.347.2040",".07","","",""
"g092920","","09/29/2020","","","","","","106.347.2050","[=12=].00","","",""
"g092920","","09/29/2020","","","","","","106.347.2050",".00","","",""
这就是停止在字符串周围使用双引号所需的全部内容,请注意 fieldBoundary 选项:
var table = $('.table').DataTable({
"paging": false,
"ordering": false,
"info": false,
"searching": false,
bSortCellsTop: false,
dom: 'Bfrtip',
buttons: [
$.extend(true, {}, buttonCommon, {
extend: 'csvHtml5',
fieldBoundary: ''
})
]
});