Features

Remote Bind

Remote Bind

The PivotEngine component binds to a remote action url which provides the data.

Features

Settings

Description

In this sample, the PivotEngine binds to a remote action url which provides the data to be aggregated.
All the data will be transferred to the client. The PivotEngine will calculate the data at the client-side.
The PivotPanel control and the PivotGrid control are bound to the PivotEngine.
You can change the view definition in the PivotPanel control.
The PivotGrid control reflects the changes in the aggregated data.
You can find the detailed raw data shown in a grid by double-clicking a cell in the PivotGrid control.

When the data row count is lower than 10,000, you can use Bind(data) or Bind(url) mode.
Otherwise, please use BindService(url) mode.

using C1.Web.Mvc;
using C1.Web.Mvc.Serialization;
using OlapExplorer.Models;
using System.Web.Mvc;
using System.Linq;
using System.Collections.Generic;

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.DemoSettingsModel = OlapModel;
            return View();
        }

        public ActionResult RemoteBind_Read([C1JsonRequest] CollectionViewRequest<ProductData> requestData)
        {
            return this.C1Json(CollectionViewHelper.Read(requestData, RemoteData));
        }
    }
}
@model IEnumerable<ProductData>
@{
    ClientSettingsModel optionsModel = ViewBag.DemoSettingsModel;
}

@(Html.C1().PivotEngine().Id("remoteEngine")
        .Bind(Url.Action("RemoteBind_Read"))
        .RowFields(pfcb => pfcb.Items("Country"))
        .ColumnFields(cfcb => cfcb.Items("Product"))
        .ValueFields(vfcb => vfcb.Items("Sales")))

<div class="row">
    <div class="col-sm-4 col-md-4">
        @Html.C1().PivotPanel().Id(optionsModel.ControlId).ItemsSourceId("remoteEngine")
    </div>
    <div class="col-sm-8 col-md-8">
        @Html.C1().PivotGrid().Id("indexGrid").ItemsSourceId("remoteEngine")
    </div>
</div>

@section Description{
<p>@Html.Raw(Resources.Olap.RemoteBind_Text0)</p>

<p>@Html.Raw(Resources.Olap.RemoteBind_Text1)</p>

}
@section Summary{
<p>@Html.Raw(Resources.Olap.RemoteBind_Text2)</p>

}