При использовании DatePicker в tablesorterk, таких как This Example он говорит:Tablesorter + Datepicker Формат даты Сломанный
// add any of the jQuery UI Datepicker options here (http://api.jqueryui.com/datepicker/)
, который мы можем предположить, что включает в себя dateFormat
, но по какой-то причине, только DateFormat, что работает это один в примере и по умолчанию.
Работы
dateFormat : 'M dd, yy'
// comparison: Oct 13, 2013
dateFormat : 'M dd, yy'
// comparison Sep 22, 2013
не работает
dateFormat : 'D M dd'
// comparison: Fri Oct 04
dateFormat : 'M dd'
// comparison Sep 22
Пример:
JQuery
$(function() {
$("table").tablesorter({
widthFixed : true,
widgets: ["filter"],
widgetOptions : {
filter_formatter : {
0 : function($cell, indx){
return $.tablesorter.filterFormatter.uiDateCompare($cell, indx, {
dateFormat : 'D, M dd, yy',
changeMonth : true,
changeYear : true,
compare : '='
});
}
}
}
});
});
HTML
<table class="tablesorter">
<thead>
<tr>
<th data-placeholder="Sort By Date">Date (one input; greater than)</th>
</tr>
</thead>
<tbody>
<tr><td>Wed, Jun 26, 2013</td></tr>
<tr><td>Wed, Aug 21, 2013</td></tr>
<tr><td>Sun, Oct 13, 2013</td></tr>
<tr><td>Sat, Jul 6, 2013</td></tr>
<tr><td>Tue, Dec 10, 2012</td></tr>
</tbody>
</table>
это незначительные изменения формата даты, но это приводит к таблице, не будучи в состоянии фильтровать. Есть ли другой формат? Мне не хватает библиотеки?
Библиотеки
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.0/themes/cupertino/jquery-ui.css">
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.0/jquery-ui.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js"></script>
<script src="jquery.tablesorter.min.js"></script>
<script src="jquery.metadata.js"></script>
<script src="jquery.tablesorter.widgets.js"></script>
<script src="jquery.tablesorter.widgets-filter-formatter.js"></script>