twitter-bootstrap 如何在引导数据表插件上对日期格式 d/m/y 进行排序?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26862382/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to sort date format d/m/y on bootstrap datatables plugin?
提问by asik
I am using thisbootstrap data-tables responsive plugin. Everything is fine, but this plugin can't sort the column with date (dd/mm/YYYY) format. The plugin only can sort with YYYY/mm/dd format. So, how can I sort the dd/mm/YYYY date format with this plugin?
我正在使用这个引导数据表响应插件。一切都很好,但是这个插件不能用日期 (dd/mm/YYYY) 格式对列进行排序。该插件只能按 YYYY/mm/dd 格式排序。那么,如何使用此插件对 dd/mm/YYYY 日期格式进行排序?
By the way, I am found the plugin codefrom the datatables.net that allow to sort the dd/mm/YYYY format.
顺便说一句,我从 datatables.net 中找到了允许对 dd/mm/YYYY 格式进行排序的插件代码。
Can someone help me to combine (may be) the original plugin and the add on code above? Thanks...
有人可以帮我结合(可能是)原始插件和上面的附加代码吗?谢谢...
回答by dm4web
in td tag add a hidden span tag with date in format YYYY/mm/dd.
在 td 标签中添加一个隐藏的跨度标签,日期格式为 YYYY/mm/dd。
HTML:
HTML:
<td><span class="hidden">YYYY/mm/dd</span>dd/mm/YYYY</td>
CSS:
CSS:
.hidden{display:none}

