我正在尝试为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);
}
}
Run Code Online (Sandbox Code Playgroud)