Sorting the Grid Multi-Check 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
- Specify a DataSource in the
Filterable
configuration of the Grid column. - 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);
}