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

[Solved] MVC Grid: Possible Bug in filtering datetime's

1 Answer 50 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
John Oxley
Top achievements
Rank 1
John Oxley asked on 24 Feb 2010, 12:13 PM
I think I have found a possible bug in the Telerik MVC grid.

If you filter by datetime, then filter by anything else and the URL is incorrect.  My controller is:

[GridAction] 
public ActionResult Index(GridCommand command) 
    IQueryable<Person> ppl = GetData(); 
    return View(ppl); 
Where Person is:
public class Person 
    public string Name { getset; } 
    public DateTime DateOfBirth { getset; } 

I've setup the style and script registrars then my view is:
<asp:Content ID="indexContent" ContentPlaceHolderID="MainContent" runat="server"
   <% Html.Telerik().Grid(Model).Name("Grid").Filterable().Render(); %> 
</asp:Content> 
 

This creates the grid as expected.  When you filter on a datetime, it works but the resulting page has this generated by the script registrar:

jQuery('#Grid').tGrid({columns:[{"name":"Name","type":"String"}, 
{"name":"DateOfBirth","type":"Date","filters":[{"operator":"eq","value":"\/Date(398296800000)\/"}]}], plugins:["gridFilter"], urlFormat:'/?Grid-page=%7B0%7D&Grid-orderBy=%7B1%7D&Grid-filter=%7B2%7D', pageSize:0});}); 
Note the value of the filter for DateOfBirth.  When it gets to the parsing of this value in telerik.grid.filter.js on line 238, method parseDate, this blows up and the resultant URL has 
DateOfBirth~eq~datetime'NaN-NaN-NaNT12-NaN-NaN'

I'm using the latest Telerik MVC Build Telerik_Extensions_for_ASPNET_MVC_2009_3_1320_OpenSource.


1 Answer, 1 is accepted

Sort by
0
Accepted
Atanas Korchev
Telerik team
answered on 24 Feb 2010, 12:43 PM
Hi John Oxley,

Thank you for reporting this problem. Until we fix it I can suggest you use Ajax binding. In that case the problem will not manifest itself.

Regards,
Atanas Korchev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Grid
Asked by
John Oxley
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Share this question
or