Features

Remote Bind

Remote Bind

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

Features

header
header
header
Product
header
Country
header
Sales (Sum)
Product:Aoba;Sales:0;
Product:Olap;Sales:0;
Product:Wijmo;Sales:0;
Product:Xuni;Sales:0;
Sales:0;
78,043
118,165
102,016
62,727
360,951
159,316
81,179
102,375
102,439
445,309
82,549
202,056
111,878
103,718
500,201
157,328
143,868
106,136
114,587
521,919
126,928
152,979
123,742
91,240
494,889
115,271
66,788
107,182
164,000
453,241
77,688
128,299
117,918
69,393
393,298
118,133
106,206
106,447
115,665
446,451
125,424
109,583
112,220
100,790
448,017
121,630
73,956
135,813
91,641
423,040
86,155
119,463
144,288
139,258
489,164
1,248,465
1,302,542
1,270,015
1,155,458
4,976,480

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.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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));
        }
    }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
@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>
 
}