1

Kendo UI Grid を使用して結果を表示しています。ドキュメント (http://www.kendoui.c​​om/documentation/asp-net-mvc/helpers/grid) で説明されているように、asp.net mvc ヘルパー拡張メソッドを使用して、カスタム バインディングでグリッドを作成し、ページングを実装しています。 /custom-binding.aspx)。結果データは、5 つの異なるグループ (Group1Id、Group2Id...) にグループ化できます。これらのグループ ID を使用して結果をグループ化する必要があります。groupBy の実装方法を教えてください。Telerik グリッド (Web フォーム用) では、GridGroupByExpression を使用しました。この動作に似たものが欲しいです。がある

.Group(groups =>
    {
       groups.Add(p => p.Group1Id);
        groups.Add(p => p.Group2Id);
    }

カスタムバインディングでは機能しませんでした。ただし、サーバー バインディングでは機能します。Ajax バインディングはまだ試していません。

4

1 に答える 1

1

グループ化は、カスタム バインドの並べ替えと同様に行われます。

public ActionResult Index([DataSourceRequest]DataSourceRequest request)
{
  IQueryable<Order> orders = new NorthwindDataContext().Orders;

  //Apply grouping
  foreach (GroupDescriptor groupDescriptor in request.Groups)
  {
    switch (groupDescriptor.Member)
    {
      case "Group1Id":
        orders.GroupBy(s => s.Group1Id);
        break;
      case "Group2Id":
        orders.GroupBy(s => s.Group2Id);
        break;
    }
  }

  return View(orders);
}
于 2012-06-28T00:43:10.763 に答える