gpt4 book ai didi

javascript - 将数据表导出按钮移至表底部

转载 作者:行者123 更新时间:2023-12-01 07:04:11 25 4
gpt4 key购买 nike

我在数据表中创建了一个导出选项,我希望它显示在表格下方,现在它显示在表格上方。谈论可能会在表格末尾的分页旁边显示的下载按钮。

$(document).ready(function (){
var table = $('#example').DataTable({
'responsive': true,
dom: 'Bfrtip',
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print'
]
});

// Handle click on "Expand All" button
$('#btn-show-all-children').on('click', function(){
// Expand row details
console.log('Inside click');
table.rows(':not(.parent)').nodes().to$().find('td:first-child').trigger('click');
});

// Handle click on "Collapse All" button
$('#btn-hide-all-children').on('click', function(){
// Collapse row details
table.rows('.parent').nodes().to$().find('td:first-child').trigger('click');
});

$('#btn-show-all-children').trigger('click');
});

这是 fiddle https://jsfiddle.net/x5q3anys/

最佳答案

dom 设置字符串中,将 B 放在字符串末尾,如下所示:

dom: 'frtipB'

来自文档:

Each table control element in DataTables has a single letter associated with it, and that letter it used in this dom configuration option to indicate where that element will appear in the document order.

了解更多:documentation

关于javascript - 将数据表导出按钮移至表底部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56595121/

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