Kendo 日期范围结束日期过滤

Kendo date range end date filtering

尝试设置结束日期以过滤 kendo 网格。现在用户可以在两个日期之间进行过滤,但如果用户只是输入结束日期,我需要过滤网格。这是我正在使用的代码,不确定我遗漏了什么。我的网格与这个类似,但结束日期无效 http://jsfiddle.net/OnaBai/5bchz/86/

var orderDateFromFilter = $("#FromDate").val().split('-');
var orderDateToFilter = $("#ToDate").val().split('-');

if (orderDateFromFilter == "") {
    orderDateToFilter = "";
    $("#ToDate").val("");
    $("#input5").val("");
    $("#input6").val("");
}
else if (orderDateToFilter == "") {
    $("#ToDate").val($("#FromDate").val());
    $("#input6").val($("#input5").val());
    orderDateToFilter = orderDateFromFilter;
}

var mydate1 = new Date(orderDateFromFilter[0], orderDateFromFilter[1]-1, orderDateFromFilter[2]);
var mydate2 = new Date(orderDateToFilter[0], orderDateToFilter[1]-1, orderDateToFilter[2]);

var filter = { logic: "and", filters: [] };

    filter.filters.push({ field: "FilterByDate", operator: "gte", value: mydate1 });
    filter.filters.push({ field: "FilterByDate", operator: "lte", value: mydate2 });

    if (orderDateFromFilter== "" && orderDateToFilter == "")
        filter = "";
    grid.dataSource.filter(filter);
}
   

添加这个对我有用的过滤逻辑“filter”变量,使其具有逻辑“or”->“var filter = { logic: “or”, filters: [] };”