New to Telerik UI for ASP.NET MVC? Download free 30-day trial

Sort the Grid MultiCheck Filter Items

Environment

Product Version 2022.3.913
Product Telerik UI for ASP.NET MVC Grid

Description

How can I sort the multi-check items in the column filter menu of the Telerik UI for ASP.NET MVC Grid?

Solution

  1. Specify a DataSource in the Filterable configuration of the Grid column.
  2. Configure the sort option of the DataSource and set the desired order.
  columns.Bound(p => p.Details).Filterable(ftb =>
  {
    ftb.Multi(true);
    ftb.Search(true);
    ftb.CheckAll(true);
    ftb.DataSource(dataSource => dataSource
      .Custom()
      .Transport(t => t.Read("ReadFilterMenuItems", "Grid"))
      .Sort(sort => {
          sort.Add("Details").Descending();
      })
    );
  });
  public ActionResult ReadFilterMenuItems()
  {
    var result = gridDataCollection.GroupBy(p => p.Details).Select(grp => grp.FirstOrDefault());
    return Json(result);
  }

See Also

In this article