This is a migrated thread and some comments may be shown as answers.

Kendo grid date filter with operator is before or equal showing null records

7 Answers 707 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Shailesh
Top achievements
Rank 1
Shailesh asked on 30 Jun 2015, 06:54 PM
I tried to filter in attached POC Due Date column with operator "Is before or equal to"  and date 23-june-2015, in the output it gives null records, which i don't want. can you please help.

7 Answers, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 02 Jul 2015, 02:54 PM

Hello Shailesh,

Indeed this behavior is caused by the fact that filtering operations is performed against the original data. 

In your case the date typed in the date picker is in different format than the original data format. 

Please set the configuration of the "Due Date" column as shown below in order to parse the 23-june-2015 to the original data format and filter properly. 

{
  field: "DueDate", title: "DueDate",
  format: '{0:MM-dd-yyyy}',
  filterable : {
    ui: function (element) {
      element.kendoDatePicker({
        format: "MM-dd-yyyy",
        parseFormats: ["dd-MMMM-yyyy"]
      });
    }
  }
}

 

 

Regards,

Boyan Dimitrov

Telerik

 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Shailesh
Top achievements
Rank 1
answered on 02 Jul 2015, 04:54 PM

Hello Boyan 

After adding above code, still issue is not resolved, attached updated poc and screen shot is for your reference. 

0
Boyan Dimitrov
Telerik team
answered on 06 Jul 2015, 11:59 AM

Hello Shailesh,

 

I extracted the logic related to the Grid widget to the following http://dojo.telerik.com/alABU example. 

 

Typing the "23-june-2015" text in the Due Date date filter is working as expected. Could you please modify the example in order to replicate the problem? 

 

Regards,
Boyan Dimitrov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Shailesh
Top achievements
Rank 1
answered on 06 Jul 2015, 01:38 PM

Hello Boyan,

I have reviewed the example. As i said if i type date "23-June-2015" and select operator  "Is before or equal to", the output is showing records of null date at the bottom. which i don't want. Could you please help to resolve this issue.

Attached image is for your reference.

Regards,

Shailesh Rathi.

 

0
Boyan Dimitrov
Telerik team
answered on 08 Jul 2015, 08:49 AM

Hello Shailesh,

 

The reason for this behavior is because the "Date" type operator compares only Date objects. Filtering is comparing the milliseconds value of the Date objects. Since null objects are not valid Date objects, the comparing could not work properly. 

 

A possible solution would be setting a valid "Due Date" Date value for each record in order the comparing to work properly. 

 

Regards,
Boyan Dimitrov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Shailesh
Top achievements
Rank 1
answered on 08 Jul 2015, 01:28 PM

Hello Boyan, 

In my scenario the possibilities of coming null values date, but when filter with operator "Is before or equal to", the output should not show null date records as per business prospect. Can you provide solution on it.

 Regards,

Shailesh Rathi.

0
Boyan Dimitrov
Telerik team
answered on 10 Jul 2015, 10:10 AM

Hello Shailesh,

 

The filtering functionality compares each DueDate value with the one typed in the input field.  The relational operators (>= and <=) perform conversion to type of Number, all the relational operators present have this behavior. The operators evaluate "null" as 0 and the Date object are evaluated to their milliseconds value. This is all done by JavaScript. 

 

There is also an option to enable the serverFiltering and leave the filtering implementation to the remote service. 

 

Regards,
Boyan Dimitrov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Shailesh
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
Shailesh
Top achievements
Rank 1
Share this question
or