TimePicker Grid Column Filter

2 posts, 0 answers
  1. Joel
    Joel avatar
    207 posts
    Member since:
    Jun 2018

    Posted 16 Apr 2020 Link to this post

    My Grid Column Filter for a Time value is not working by this definition:



    public partial class Session : PropertyBase
        [Display(Name = "Id")]
        public int Id { get; set; }
        [Display(Name = "Device Id")]
        public System.Int32? DeviceId { get; set; }
        [Display(Name = "Group Id")]
        public System.Int32? GroupId { get; set; }
        public System.String UniqueId { get; set; } = $"{Guid.NewGuid()}";
        /// <summary>
        /// Track when the session took place
        /// </summary>
        public System.DateTime? Timestamp { get; set; }
        public System.DateTime? Date => Timestamp;
        public System.DateTime? Time => Timestamp;



        .Columns(columns =>
            columns.Command(command => command
            columns.Bound(p => p.Date).Title("Date").Format("{0:MM/dd/yyyy}")
                .Filterable(ftb => ftb.Cell(cell => cell.Operator("gte")
            columns.Bound(p => p.Time).Title("Time")
                .Format("{0:hh:dd:mm tt}")
                .Filterable(x => x.UI(GridFilterUIRole.TimePicker));
        .Filterable(ftb => ftb.Mode(GridFilterMode.Row))
        .HtmlAttributes(new { style = "height:550px;" })
        .DataSource(dataSource => dataSource
        .Read(read => read.Action("IndexJson", "Sessions")
  2. Nikolay
    Nikolay  avatar
    301 posts

    Posted 21 Apr 2020 Link to this post

    Hello Joel,

    Thank you for sharing the model and the grid implementations.

    I believe that the TimePicker does not filter correctly due to the difference in the format the values are received and the format the filter works with. Could you ensure the Time values are in the following format?

    For your convenience, based on the provided snippets I have prepared a small ASP.NET Core project with Time filter correctly working for a DateTime field.

    Let me know if you have any questions.

    Progress Telerik

    Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
    Our thoughts here at Progress are with those affected by the outbreak.
Back to Top