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
Filtering.md 2.52 KB
Copy Edit Web IDE Raw Blame History

GridBlazor for ASP.NET Core MVC

Filtering

Index

You can enable the filtering option for your columns. To enable this functionality use the Filterable method of the Column object:

    Columns.Add(o => o.Customers.CompanyName)
        .Titled("Company Name")
        .Filterable(true)
        .Width(220)

After that you can filter this column.

You can enable filtering for all columns of a grid using the Filterable method for both GridClient and GridServer objects:

  • razor page

        var client = new GridClient<Order>(q => orderService.GetOrdersGridRows(columns, q), query, false, "ordersGrid", Columns, locale)
            .Filterable()
  • service method

        var server = new GridServer<Order>(repository.GetAll(), Request.Query, true, "ordersGrid", columns, 10)
            .Filterable()

You can enable a button to clear all selected filters using the ClearFiltersButton method of the GridClient object:

    var client = new GridClient<Order>(q => orderService.GetOrdersGridRows(columns, q), query, false, "ordersGrid", Columns, locale)
        .ClearFiltersButton(true);

GridBlazor supports several types of columns (specified in the Add method):

  • System.String
  • System.Guid
  • System.Int32
  • System.Int64
  • System.Boolean
  • System.DateTime
  • System.Decimal
  • System.Byte
  • System.Double
  • System.Single
  • enum

It also supports nullable types of any element of the list.

GridBlazor has different filter widgets for these types:

  • TextFitlerWidget: it provides a filter interface for text columns (System.String). This means that if your column has text data, GridBlazor will render an specific filter interface:

  • NumberFilterWidget: it provides a filter interface for number columns (System.Int32, System.Decimal etc.)

  • BooleanFilterWidget: it provides a filter interface for boolean columns (System.Boolean):

  • DateTimeFilterWidget: it provides a filter interface for datetime columns (System.DateTime):

Multiple filters

Pressing the + and - buttons you can add multiple options to filter. You can also select the condition you want to use, either And or Or:

You can also create your own filter widgets.

<- Searching | Using a list filter ->

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