gpt4 book ai didi

jQuery 数据表 : Disabling sorting for specific columns

转载 作者:太空宇宙 更新时间:2023-11-04 12:36:07 27 4
gpt4 key购买 nike

我的 jQuery 数据表中有 6 列,我想对第一列和最后一列禁用排序。

我使用了以下代码:

$('#UserDetails').dataTable({
"aoColumns": [
{ "bSortable": false },
null,
null,
null,
null,
{ "bSortable": false }
]
});

此代码禁用对最后一列而不是第一列的排序。

有人可以帮忙吗?

最佳答案

试试这个

$('#UserDetails').dataTable( {
"aoColumnDefs": [
{ 'bSortable': false, 'aTargets': [ 0,5 ] }
]
});

其中 0,5 是要从排序中排除的列的索引

关于jQuery 数据表 : Disabling sorting for specific columns,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27266723/

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