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

Date filtering not working with grid

4 Answers 469 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Trent
Top achievements
Rank 1
Trent asked on 18 Jun 2012, 11:16 AM
Hi there,

I'm busy migrating from the ASP.Net MVC controls to the Kendo MVC controls and we're having an issue with the date column. For the ASP grid we would do:

columns.Bound(o => o.MyDate).Format("{0:dd MMMM yyyy}");

This worked well. Using the same line in the Kendo grid gave an incorrect date format, so for the Kendo grid we're doing this:

columns.Bound(o => o.MyDate).ClientTemplate("#= kendo.toString(toDate(MyDate),'dd MMMM yyyy') #");

With a bit of Javascript magic this works too. However, the filtering just shows text boxes instead of allowing me to choose a date like the ASP MVC filter does. I've attached a screenshot since I'm probably not explaining this very well...

Is this a bug or am I doing this incorrectly?

Thanks.

4 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 21 Jun 2012, 09:12 AM
Hello Trent,

This is unknown issue. Could you send a small runnable sample so I can check the setup and investigate what exactly is causing the problem?

Regards,
Daniel
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Peter P
Top achievements
Rank 1
answered on 03 Jul 2012, 12:01 PM
Hi,
I'm trying with other different code part and date filtering does not work:

ASP. NET code [repeater]
..........
                      $(document).ready(function() {
                    $("#grid").kendoGrid({
                    dataSource: {
                            schema: {
                                model: {
                                    fields: {
                                        rank: { type: "number" },
                                        rating: { type: "number" },
                                        descripcion: { type: "string" },
                                        year: { type: "date" }
                                    }
                                }
                            },
                            pageSize: 10
                        },   
                        height: 380,
                        groupable: true,      
                        sortable: true,
                        filterable: true,
                        pageable: true,        
                        columns: [
                            {
                                field: "rank",
                                title: "First Name"
                            },
                            {
                                field: "rating",
                                title: "Last ame"
                            },
                            {       
                                width: 200,
                                field: "descripcion"
                            },
                            {       
                                    width: 80,
                                field: "year", format: "{0:dd-MM-yyyy}",
                                template: '#= kendo.toString(year,"dd/MM/yyyy") #'
                            }
                        
                            ]
                  });
                });

Can any admin tell me what is wrong??

Thanks!
0
David
Top achievements
Rank 1
answered on 16 Jul 2012, 08:05 PM
date filtering is broken in grids when bound to remote data. You can see this by viewing the filters posted back to the server for instance:

  1. take:
    20
  2. skip:
    0
  3. page:
    1
  4. pageSize:
    20
  5. filter[filters][0][field]:
    timestamp
  6. filter[filters][0][operator]:
    gt
  7. filter[logic]:
    and


There should be a filter[filters][0][value] parameter being sent to the server
0
David
Top achievements
Rank 1
answered on 16 Jul 2012, 08:30 PM
verified that this is a bug with kendo (or perhaps jquery depending on who you ask). Please see  https://github.com/rwhitmire/KendoGridBinder/issues/5 for a workaround
Tags
Grid
Asked by
Trent
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Peter P
Top achievements
Rank 1
David
Top achievements
Rank 1
Share this question
or