Tablesorter - custom parser dependent on sorting type

▼魔方 西西 提交于 2020-02-06 04:05:14

问题


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.


回答1:


Short answer: No.

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).

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.



来源:https://stackoverflow.com/questions/20798504/tablesorter-custom-parser-dependent-on-sorting-type

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!