Jquery Datatables排序和响应。recalc()冻结我的浏览器
我有一个模态,里面有一个数据表 这是thead:Jquery Datatables排序和响应。recalc()冻结我的浏览器,jquery,datatables,Jquery,Datatables,我有一个模态,里面有一个数据表 这是thead: <thead> <tr> <th data-priority="1" class="noVis"></th> <th data-priority="1" class="text-center azioni colCheckbox noVis"><input value="1" type="checkbox" /></th>
<thead>
<tr>
<th data-priority="1" class="noVis"></th>
<th data-priority="1" class="text-center azioni colCheckbox noVis"><input value="1" type="checkbox" /></th>
<th data-priority="1" class="noVis">Anteprima</th>
<th data-priority="1" class="noVis">Nome</th>
<th data-priority="1">---</th>
<th data-priority="3">---</th>
<th data-priority="3">---</th>
<th data-priority="4">---</th>
<th data-priority="5">---</th>
</tr>
</thead>
初始订购由ASC按名称列进行
在我为描述顺序单击“名称顺序”列后,我得到的问题原因响应没有出现(我有一些单元格名称为空,因此所有列都保留在ASC顺序视图中,但我还有一个单元格名称具有长值,因此如果我单击描述顺序,我会遇到此问题)
但是,如果我使用DESC order初始化datatables,那么一切都正常,因为响应已初始化
我尝试插入此代码(所有表的全局代码):
但是浏览器(firefox被冻结)。我得到错误日志:“递归太多”
如何强制datatable在订单列之后检查响应
更新:My fiddle我更新了fiddle以查看问题:您是否看到在排序后滚动数据时,列没有随数据移动。如果您更新jsbin,请在问题中提及。
"aaSorting": [[ 3, "asc" ]],
responsive: {
details: {
type: 'column',
target: 0
}
},
"columnDefs": [
{
orderable: false,
className: 'control',
searchable: false,
targets: 0
},
{
orderable: false,
className: 'selectall-checkbox',
searchable: false,
targets: 1
}
],
select: {
style: 'multi',
selector: 'td:nth-child(2)'
},
$(document).on('order.dt', function () {
$.fn.dataTable.tables( {visible: true, api: true} ).columns.adjust().responsive.recalc().draw();
} );