[英]How to prevent sorting on specific table column - DataTable?
我不想對我的操作列進行排序,所以我做了:
<th class="no-sort" >Actions</th>
並像這樣更新我的 JS
$('table').DataTable( {
"bLengthChange": true,
"Filter": true,
"Info": true,
"bSort": true,
"bPaginate": false,
"searchHighlight": true,
"aoColumnDefs": [{
"bSort": false,
"aTargets": ["no-sort"]
}]
} );
我仍然看到它是可排序的。 🤦🏻♂️
我該如何阻止?
正確的屬性是bSortable
,而不是bSort
。 查看文檔
"aoColumnDefs": [{
"bSortable": false,
"aTargets": ["no-sort"]
}]
另請注意,從您使用aoColumnDefs
看來,您使用的是非常舊版本的 DataTables; 事實上至少5歲。 我建議在可能的情況下升級它。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.