grid filter customization

3 posts, 0 answers
  1. Paddy
    Paddy avatar
    12 posts
    Member since:
    Aug 2015

    Posted 11 Sep 2015 Link to this post

    Hi,  

    I'm trying to customize the filter of a column of date type. By default the filter UI of date type is is an operator type of equal/before/after with a datepicker. But I want the filter to be more powerful. I want to filter by specific date or by number. If it is by date then it is no difference with the default filter. But if it is filtered by numbers (days and hours), I hope it can be filtered by the difference of days and hours between now and the date value in database. 

    The server side is implemented with ASP.NET WEB API with odata. It seems obvious that the filter parameter passed to the server side should be converted to a date on the client when filtering by day and hour number. To distinguish the filter type between date and day/hour number, I think a switcher is also needed on the UI. 

    I'd like to know, if this kind of filter customization (a standard UI with an extra filter type switcher, days and hours textbox ) is possible? Is there an api giving me the chance to convert the numbers to a date before submitting for server side filtering?

    Thank you for your help!

  2. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 15 Sep 2015 Link to this post

    Hi,

    You could modify the filter UI element to be a DateTimePicker widget instead of a DatePicker. This way you will be able to pick the exact days and hours. A live example is available here:
    http://demos.telerik.com/aspnet-mvc/grid/filter-menu-customization

    Regards,
    Pavlina
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Paddy
    Paddy avatar
    12 posts
    Member since:
    Aug 2015

    Posted 15 Sep 2015 Link to this post

    Hi Pavlina,

     Thank you for your reply. Maybe I didn't put the question clearly. I made a picture to illustrate what I would like to achieve.

    The filter that I want to customize the on a datetime type column. I'd like to filter it by specific date/time or by days and hours difference compared with current date. So I make a switcher on the filter UI to select filter type. On the left of the picture, it is filtered by date, it is default behavior of filter on a datetime column. On the right, it is UI filtered by days and hours numbers. 

     

    My questions are:

    (1) This UI seems too complicated, is it possible to be implemented?

    (2) Currently the data is returned from the server via web api and odata. Because the column I'd like to filter is a datetime type, so it should accept only parameters of datetime type one the server side. When I'm using the days and hours number to filter, how should I convert the day/hour number to a specific datetime type value?

     Hope I explain it clearly this time. Thanks for your help.

Back to Top