jquery表排序器排序问题
大家晚上好,
我正在尝试实现 jquery 表排序器,一切看起来都很好并且按列排序,但是由于某种原因,日期(默认)列不按我正在使用的日期格式排序。这是代码:
<script type="text/javascript">
$(document).ready(function()
{
$("#myTable").tablesorter( {sortList: [[0,0]]} );
}
);
</script>
日期列是第一列,日期按以下格式编写: 2011 年 6 月 2 日 11 十月 15 日等
另外,根据上面的代码,如何禁用对特定列(第 6 列,即最后一列)进行排序的选项?我这辈子也想不通!
如果失败了,我非常乐意使用日期格式 dd/mm/yyyy 如果更容易的话?
Good evening all,
I'm trying to implement jquery table sorter, all seems fine and sorts by columns, however for some reason the date (default) column doesn't sort by the date format I'm using. This is the code:
<script type="text/javascript">
$(document).ready(function()
{
$("#myTable").tablesorter( {sortList: [[0,0]]} );
}
);
</script>
The date column is the first column and the dates are written in this format:
2 June 11
15 October 11 etc
In addition, from the above code, how would you disable the option to sort a particular column (column 6, which is the final column)? Can't for the life of me figure it out!
Failing this, I'm more than happy to use the date format as dd/mm/yyyy if it's easier?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试此方法禁用第 6 个标头的排序:
的文档
请参阅此处了解有关此选项 对这些类型的日期进行排序,您可能需要自己进行排序实现,因为
tablesorter
不知道date
是什么(以该格式),因此您可以添加日期解析器,如文档中的说明。
try this to disable sorting on 6th header:
see here for doc on this option
to sort those types of dates you might have to make your own sorting implementation because
tablesorter
doesn't know what adate
is (in that format)so you can add a date parser, as explained in the doc.