如何在bootstrap datatable插件上对日期格式d/m/y进行排序?

时间:2022-01-22 21:31:11

I am using this bootstrap 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?

我正在使用这个引导数据表响应插件。一切都很好,但是这个插件不能用date (dd/mm/YYYY)格式对列进行排序。该插件只能对yyyyy /mm/dd格式进行排序。那么,我如何用这个插件对dd/mm/YYYY日期格式进行排序呢?

By the way, I am found the plugin code from 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...

有人能帮我合并(可能是)原来的插件和上面添加的代码吗?谢谢……

1 个解决方案

#1


10  

in td tag add a hidden span tag with date in format YYYY/mm/dd.

在td标签中添加一个日期为yyyyy /mm/dd格式的隐藏跨度标签。

HTML:

HTML:

<td><span class="hidden">YYYY/mm/dd</span>dd/mm/YYYY</td>

CSS:

CSS:

.hidden{display:none}

#1


10  

in td tag add a hidden span tag with date in format YYYY/mm/dd.

在td标签中添加一个日期为yyyyy /mm/dd格式的隐藏跨度标签。

HTML:

HTML:

<td><span class="hidden">YYYY/mm/dd</span>dd/mm/YYYY</td>

CSS:

CSS:

.hidden{display:none}