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:
string.png
  • 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
datetime.png

Also you can create your own filter widget.

Read more: How to: creating custom filter widget

Last edited Sep 25, 2013 at 10:54 AM by Bukharin, version 6