简体   繁体   中英

Date Issue in Kendo UI when Filter Grid

When we filter Kendo datagrid, use different types of operator like eq, and, or, gt, lt etc. that's work well in string and number. When we use date to match another date using eq operator does not work but gt,lt works.

This is my source code

dataSource: {
                       data: data,

                       schema: {
                           model: {
                               fields: {
                                   date: { type: "date"},
                                   id: { type: "string" },
                                   name: { type: "number" },
                                   account: { type: "number" }

                               }
                           }

                       },
                       sort: [ { field: "date", dir: "desc" }],

                       filter : [{
                                field: "date", operator: "eq", value: dateString

                                }],

                       pageSize: 30,
        }              

probably your datestring is not being read has a date, so when it goes filter it throws a error.

Try to or use the format propertie in the grid

 columns   : [
    {
        field       : "Date",
        title       : "Date",
        format      : "{0:dd-MMM-yyyy}",
        filterable: {
            ui: "datepicker"
        }
    }
]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM