Skip to content
adrian edited this page Aug 11, 2017 · 4 revisions

Filtering

Since Grid.Mvc 2.0 you can enable filtering option for your columns. To enable this functionality use Filterable method:

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

After that you can filter this column. Grid.Mvc support several types of columns (specified in Add method):

  1. System.String
  2. System.Int32
  3. System.Int64
  4. System.Boolean
  5. System.DateTime
  6. System.Decimal
  7. System.Byte
  8. System.Double
  9. System.Single

Also supports nullable types of this list.

To build more user friendly interface Grid.Mvc has different filter widget for this types. TextFitlerWidget - provides filter interface for text columns (System.String). This means that if your column has text data - Grid.Mvc render specific filter interface:

NumberFilterWidget - provides filter interface for number columns (System.Int32, System.Decimal etc.) number.png BooleanFilterWidget - provides filter interface for boolean columns (System.Boolean): boolean.png DateTimeFilterWidget - provides filter interface for datetime columns (System.DateTime). To render DatePicker control you need setup Grid.Mvc datepicker (https://www.nuget.org/packages/Grid.Mvc.DatePicker/) on the page. datetime.png

Also you can create your own filter widget.

Clone this wiki locally