Tablesorter-自定义解析器,取决于排序类型 [英] Tablesorter - custom parser dependent on sorting type
问题描述
是否可以检查所使用的内部格式功能:ASC或DESC排序?我想在对列进行DESC排序时更改数字格式.
Is it possible to check inside format function which was used: ASC or DESC sorting? I want to change number format in sorting when column is sorted DESC.
推荐答案
简短答案:否.
解析器只能将从表格中获得的文本格式化为更易于排序的格式(例如,将日期转换为可以排序和/或比较的数字).
Parsers can only format the text obtained from the table into a more sortable-friendly format (e.g. converting a date into a number that can be sorted and/or compared).
要弄乱排序的方式,您需要使用 numberSorter 检测排序方向的选项,然后执行您想做的所有事情.
To mess with how a sort is done, you'll need to use the numberSorter option to detect sort direction, then do whatever it is you wanted to do.
如果偶然是要更改表格的直观显示数字,则需要编写一个自定义窗口小部件.我可以提供帮助,但是如果没有任何代码或示例,我只会猜测您要完成什么.
If, by chance, you mean change the visually displayed numbers of the table, you'll need to write a custom widget. I could help, but without any code or examples, I would only be guessing at what you are trying to accomplish.
这篇关于Tablesorter-自定义解析器,取决于排序类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!