我正在尝试为 Razor Webgrid 实现自定义排序。具体来说,我想对未出现在 webgrid 本身的列进行排序。
我想弄清楚为什么 ListOfMatching 不会排序。任何想法将不胜感激。
谢谢
ResultsDisplayModel foo; // MVVM class to be bound to the view
// List of Matching is bound to a webgrid
// public List<ResultsModel> ListOfMatching { get; set; }
// TotalDebt is in a base class of ResultsModel called Expenses
if (sort == "DebtBurden")
{
if (foo.bSortDirection)
{
foo.bSortDirection = false;
foo.ListOfMatching.OrderByDescending(x => x.TotalDebt);
}
else
{
foo.bSortDirection = true;
foo.ListOfMatching.OrderBy(x => x.TotalDebt);
}
}