将YADCF与JQuery UI一起使用,并尝试包含以下函数:changeMonth:true,changeYear:true
在JQueryUI的示例中,这是他们使用的:
$( "#yourID" ).datepicker({
changeMonth: true,
changeYear: true,
使用YADCF我不知道如何添加它。这就是我现在的代码:
.yadcf([
{column_number: 0, filter_type: "range_date",
datepicker_type: 'jquery-ui',
changeMonth: true,
changeYear: true,
filter_container_id: "external_filter_container"}
我也尝试将“changeMonth:true,changeYear:true”插入
var datepickerDefaults = {
并使用
单独定位YADCF ID $( "#YADCFID" ).datepicker({
changeMonth: true,
changeYear: true,
到目前为止没有运气,有什么建议吗?
更新:虽然表单有效,但排序却没有。
当前脚本:
var oTable;
$(document).ready(function () {
'use strict';
$('#example').dataTable({
"columnDefs": [{ "orderable": false, "targets": 0 }],
"order": [],
dom: '<"pos1"B><"pos2"li><"pos3"f>tp',
buttons: ['copy', 'csv', 'excel', 'pdf', 'print']
}).yadcf([
{column_number: 0, filter_type: "range_date",
filter_container_id: "external_filter_container",
filter_plugin_options: {
changeMonth: true,
changeYear: true,
dateFormat: "dd/mm/yy"
}
}
]);
SyntaxHighlighter.all();
});
和html:
<tr>
<td>21/06/2017</td>
</tr>
<tr class="t-two">
<td>21/06/2017</td>
</tr>
搜索结果返回错误的月份,即02/02/2017,当我选择范围01/06/2017 - 02/06/2017
答案 0 :(得分:0)
您应该使用filter_plugin_options属性
像这样:
.yadcf([
{
column_number: 0,
filter_type: "range_date",
//datepicker_type: 'jquery-ui', this one is redundant because its the default value anyway
filter_container_id: "external_filter_container",
filter_plugin_options: {
changeMonth: true,
changeYear: true
}
}
])