我遇到了jQuery DataTables日期范围过滤的问题。我正在使用Bootstrap Datepicker获得(sSearch_0
= undefined~undefined
)值。当我在第一列而不是null
上添加type: "date-range"
值时,第三列过滤器工作正常。
(function ($) {
$(document).ready(function () {
// Implements the dataTables plugin on the HTML table
var oTable = $('#transactionHistoryDataTable').dataTable({
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"bServerSide": true,
"sAjaxSource": "api/Sitecore/Account/DataProviderAction",
"bProcessing": true,
"aoColumns": [
{ "sName": "Date", "bSortable": false },
{ "sName": "Name", "bSortable": false },
{ "sName": "Bracket", "bSortable": false },
{ "sName": "Activity", "bSortable": false },
],
"sDom": '<"top">tip',
"oLanguage": {
"sEmptyTable": "Your custom message for empty table"
}
}).columnFilter({
"aoColumns": [
{ type: "date-range" },
null,
{ type: "select"},
null,
]
});
});
})(jQuery);
更新
我将代码更改为服务器端过滤,如此
"fnServerParams": function (aoData) {
aoData.push({ "name": "activityParam", "value": $('#activityList').val() });
aoData.push({ "name": "dateFrom", "value": $('#dateFrom').val() });
aoData.push({ "name": "dateTo", "value": $('#dateTo').val() });
}
我提出的解决方法适用于jquery ui问题是我无法使用Jquery UI还有其他解决方法吗?