Column filtering

In addition to the toolbar search box you can also add filters to individual columns. String based columns support wildcard searching and date/time and numeric columns support the use of operators such as <, >,<=, >= and !=. Columns with lookups has selection based filters based on the values available in the dataset column. Filters are added to a grid column using the Filter property. The sample also demonstrates use of the InitialSortOrder column property to set the initial sort order of the grid to OrderDate descending.

Loading...
Razor code

var columns = new List() {
    new GridColumn("OrderID") {Filter = FilterType.Default },
    new GridColumn("CustomerID", "Customer") {Filter = FilterType.Default, Lookup = new Lookup("Customers", "CustomerID", "CompanyName")},
    new GridColumn("EmployeeID", "Employee") {Filter = FilterType.Default, Lookup = new Lookup("Employees", "EmployeeID", "LastName || ', ' || FirstName")},
    new GridColumn("OrderDate", "Ordered") {Filter = FilterType.Default, InitialSortOrder = SortOrder.Desc},
    new GridColumn("RequiredDate", "Required") {Filter = FilterType.Default},
    new GridColumn("ShippedDate", "Shipped"),
    new GridColumn("ShipVia") {Filter = FilterType.Default, Lookup = new Lookup("Shippers", "ShipperID", "CompanyName")},
    new GridColumn("Freight") {Format = "c"},
    new GridColumn("ShipName"),
    new GridColumn("ShipAddress"),
    new GridColumn("ShipCity") {Filter = FilterType.Distinct},
    new GridColumn("ShipRegion") {Filter = FilterType.Distinct},
    new GridColumn("ShipPostalCode"),
    new GridColumn("ShipCountry") {Filter = FilterType.Distinct}
};