带页脚的jQuery数据表,列重新排序不';行不通
以下是我的datatable的html代码:带页脚的jQuery数据表,列重新排序不';行不通,jquery,datatables,Jquery,Datatables,以下是我的datatable的html代码: <table id="table" width="100%"> <thead> <tr> <th id="header0">number</th> <th id="header1">name</th>
<table id="table" width="100%">
<thead>
<tr>
<th id="header0">number</th>
<th id="header1">name</th>
<th id="header2">project</th>
<th id="header3">date</th>
<th id="header4">status</th>
<th id="header5">total</th>
</tr>
<tfoot >
<tr>
<th colspan="5" style="text-align:right">total:</th>
<th></th>
</tr>
</tfoot>
</thead>
</table>
数
名称
项目
日期
地位
全部的
总数:
我已将此表的
colReorder
设置为true。只要我删除了表的页脚,列的顺序似乎就可以正常工作。但当我有了页脚并尝试拖放列时,只有列标题在移动,将数据保持原样并在控制台中导致以下错误:Uncaught TypeError:未能在“节点”上执行“insertBefore”:参数1不是“节点”类型。
是否有其他方法解决此问题,或者至少有一种方法可以不使用页脚显示总计?显然,<。这一讨论可以追溯到2013年,因此我认为除了尝试在不使用colspan的情况下显示总数之外,没有其他解决方案(可能会复制页脚中的页眉,并将invisibility:hidden
应用于不相关的页眉?)。谢谢@Sebastian的回复。我想我宁愿禁用colReorder。这样做的问题是,我使用相同的方法在我的应用程序中装箱一堆数据表。如果我需要将colReorder设置为false,我需要为这个表编写一个新方法。有没有一种方法可以在表初始化后动态禁用colReorder?我真的不知道您是如何处理表初始化的,但我想您可以有一个全局变量colReorder
,初始为true,可以在表init中使用,并且在init选项中还包括destroy:true
。如果需要初始化此表,可以将全局变量设置为false,并像第一次一样重新初始化datatable(destroy:true
允许这样做)。希望有帮助!