using C1.Web.Mvc;
using C1.Web.Mvc.Serialization;
using OlapExplorer.Models;
using System.Linq;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
namespace OlapExplorer.Controllers.Olap
{
partial class OlapController : Controller
{
private static IEnumerable<ProductData> RemoteData = ProductData.GetData(1000).ToList();
// GET: PivotGrid
public ActionResult RemoteBind()
{
OlapModel.ControlId = "remotePanel";
ViewBag.DemoOptions = OlapModel;
return View();
}
public ActionResult RemoteBind_Read([C1JsonRequest] CollectionViewRequest<ProductData> requestData)
{
return this.C1Json(CollectionViewHelper.Read(requestData, RemoteData));
}
}
}
@model IEnumerable<ProductData>
@{
ClientSettingsModel optionsModel = ViewBag.DemoOptions;
}
<c1-pivot-engine id="remoteEngine" show-row-totals="Subtotals" show-column-totals="Subtotals">
<c1-items-source read-action-url="@Url.Action("RemoteBind_Read")"></c1-items-source>
<c1-view-field-collection c1-property="RowFields" items="Country"></c1-view-field-collection>
<c1-view-field-collection c1-property="ColumnFields" items="Product"></c1-view-field-collection>
<c1-view-field-collection c1-property="ValueFields" items="Sales"></c1-view-field-collection>
</c1-pivot-engine>
<div class="row">
<div class="col-sm-4 col-md-4">
<c1-pivot-panel id="@(optionsModel.ControlId)" items-source-id="remoteEngine"></c1-pivot-panel>
</div>
<div class="col-sm-8 col-md-8">
<c1-pivot-grid id="indexGrid" items-source-id="remoteEngine"></c1-pivot-grid>
</div>
</div>
@section Settings{
@await Html.PartialAsync("_OptionsMenu", optionsModel)
}
@section Description{
<p>@Html.Raw(OlapRes.RemoteBind_Text0)</p>
<p>@Html.Raw(OlapRes.RemoteBind_Text1)</p>
}
@section Summary{
<p>@Html.Raw(OlapRes.RemoteBind_Text2)</p>
}