我正在使用这个 Bootstrap 表插件。但是按日期排序不能正常工作。
这是代码:
<table class=" table-striped" id="table" data-toggle="table"
data-search="true"
data-filter-control="true"
data-click-to-select="true"
data-escape="false">
<thead>
<tr>
<th data-field="expiry_date" data-sortable="true" scope="col"><?= 'expiry date' ?></th>
</tr>
</thead>
日期格式如下: d/m/y
(17/7/14)
我该如何修复它才能正确排序日期?
原文由 netdev 发布,翻译遵循 CC BY-SA 4.0 许可协议
您必须使用具有“数据排序器”属性的自定义排序器,例如
data-sorter="datesSorter"
然后满足您的需求: