Kendo UI Jquery Time Range Filter Not Working

26 Views Asked by At

So this is my schema of the grid

                schema: {
                    parse: function (response) {
                        var usingOnLoad = [];
                        for (var i = 0; i < response.data.length; i++) {
                            var items = {
                                plant: response.data[i].plant,
                                priority: response.data[i].priority,
                                lotCode: response.data[i].lotCode,
                                cropYear: response.data[i].cropYear,
                                growerName: response.data[i].growerName,
                                fieldName: response.data[i].fieldName,
                                variety: response.data[i].variety,
                                runNo: response.data[i].runNo,
                                comments: response.data[i].comments,
                                dateSched: response.data[i].dateSched
                            };
                            var convertDateTime = kendo.parseDate(items.dateSched);
                            if (convertDateTime instanceof Date) {
                                items.time = kendo.toString(convertDateTime, "hh:mm tt");
                                items.date = kendo.toString(convertDateTime, "yyyy-MM-dd");
                            } else {
                                items.time = "";
                                items.date = "";
                            }
                            usingOnLoad.push(items);
                        }
                        return usingOnLoad;
                    },
                    model: {
                        fields: {
                            priority: { type: "number" },
                            lotCode: { type: "string" },
                            cropYear: { type: "number" },
                            date: { type: "date" },
                            time: { type: "string" },
                            growerName: { type: "string" },
                            fieldName: { type: "string" },
                            runNo: { type: "number" },
                            variety: { type: "string" },
                            comments: { type: "string" }
                        }
                    }
                },

This how I define time field in the kendo grid column

                {
                    field: "time",
                    title: "Scheduled Time",
                    filterable: {
                        ui: 'timepicker',
                        type: "string",
                        extra: true,
                        operators: {
                            string: {
                                gt: "Are After",
                                lt: "Are Before",
                                eq: "Are Equal to"
                            }
                        }
                    },
                    attributes: {
                        style: "text-align: right;"
                    }
                },

In this scenario, when I change the string to date in the model, it will correctly filter the time range, but when I export the excel sheet, the time column will appear as a date, so I need to clarify it also. I also tried changing the string to time in the model, but the result was the same. I need to know how to correctly filter the time range in the above scenario.

0

There are 0 best solutions below