删除 jQuery DataTables 中的排序箭头

编程入门 行业动态 更新时间:2024-10-26 18:21:59
本文介绍了删除 jQuery DataTables 中的排序箭头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 jQuery DataTables 插件.

有什么办法可以去掉标题中显示的小箭头以指示排序选项吗?我想保留通过单击按此列排序的标题的功能,我只是不想显示箭头图标,因为它们更改了我的列标题的布局.

Is there a way I can get rid of the little arrows they display in the headers to indicate sorting options ? I would like to keep the functionality that by click on a header it sorts by this column, I just dont want to display the arrow icons as they change the layout of my column headers.

Firebug 显示我的标题如下:

Firebug shows my headers as follows:

<th class="sorting" role="columnheader" tabindex="0" aria-controls="myTable" rowspan="1" colspan="1" style="width: 151px;" aria-label="Category: activate to sort column ascending">Category</th>

推荐答案

图标在 CSS 类上定义为 background : url(..).通过以下方式禁用它们:

The icons is defined as background : url(..) on the CSS classes. Disable them by :

.sorting, .sorting_asc, .sorting_desc {
    background : none;
}

参见 jsfiddle -> http://jsfiddle/5V2Dx/ 注意:此解决方案是对于数据表 1.9.x!!

see jsfiddle -> http://jsfiddle/5V2Dx/ Note : This solution is for datatables 1.9.x!!

更新.使用数据表 1.10.x 时,用于重置标题图标的 CSS 有点不同:

Update. When using datatables 1.10.x, the CSS for resetting the header icons is a little bit different :

table.dataTable thead .sorting, 
table.dataTable thead .sorting_asc, 
table.dataTable thead .sorting_desc {
    background : none;
}

see -> http://jsfiddle/kqpv3ub9/(更新的演示正在使用数据表1.10.11)

这篇关于删除 jQuery DataTables 中的排序箭头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-03-28 04:13:20,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/717664.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:箭头   jQuery   DataTables

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!