1 Star 0 Fork 0

XFly-Studio / Grid.Blazor

Create your Gitee Account
Explore and code with more than 6 million developers,Free private repositories !:)
Sign up
Clone or download
Using_datetime_filter.md 1.92 KB
Copy Edit Web IDE Raw Blame History
Gustavo Navarro authored 2020-05-16 18:47 . Update documentation

GridBlazor for ASP.NET Core MVC

Using a date time filter

Index

The default behavior for a DateTime column is to use a filter widget that allows only date picking.

But it's also possible to use other DateTime formats:

  • a date time picker, where users can select year, month, day, hour, and minute info. Seconds are not supported.

    You have to add the column using the SetFilterWidgetType method of the GridColumn object using the parameter value "DateTimeLocal" and add the correct column format:

        c.Add(o => o.OrderDate).SetFilterWidgetType("DateTimeLocal").Format("{0:yyyy-MM-dd HH:mm}");
  • a week picker, where users can select year and week info.

    You have to add the column using the SetFilterWidgetType method of the GridColumn object using the parameter value "Week" and render the value using DateTimeUtils.GetWeekDateTimeString:

        c.Add(o => o.OrderDate).SetFilterWidgetType("Week").RenderValueAs(o => DateTimeUtils.GetWeekDateTimeString(o.OrderDate));
  • a month picker, where users can select year and month info.

    You have to add the column using the SetFilterWidgetType method of the GridColumn object using the parameter value "Month" and add the correct column format:

        c.Add(o => o.OrderDate).SetFilterWidgetType("Month").Format("{0:yyyy-MM}");

Examples

The UI shown by the widget will depend on the browser used:

  • Edge Chromium will show a datetime picker:

  • Chrome and Opera will show a date picker, but time must be selected manually:

  • Firefox will only allow to wirte date and time manually in "yyyy-mm-dd hh:mm" format:

<- Using a list filter | Creating custom filter widget ->

Comment ( 0 )

Sign in for post a comment

1
https://gitee.com/fan0217/Grid.Blazor.git
git@gitee.com:fan0217/Grid.Blazor.git
fan0217
Grid.Blazor
Grid.Blazor
master

Search