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;
107,089
112,231
143,192
106,074
468,586
153,468
103,914
120,461
97,627
475,470
130,586
195,382
131,278
117,142
574,388
71,572
112,536
111,850
104,931
400,889
137,521
127,446
102,438
120,686
488,091
95,279
133,802
95,857
147,942
472,880
111,805
105,184
120,629
153,022
490,640
162,524
86,994
126,558
98,237
474,313
126,368
70,613
81,730
128,696
407,407
143,990
80,466
78,497
167,962
470,915
129,501
87,442
135,377
69,607
421,927
1,369,703
1,216,010
1,247,867
1,311,926
5,145,506

Settings

Description

In this sample, the PivotEngine binds to an IEnumerable object, which provides the data to be aggregated.
All the data will be transferred to the client. The PivotEngine will calculate the data in the client-side, like Wijmo 5 olap controls.
The PivotPanel control and the PivotGrid control are bound to the PivotEngine.
You can change the view definition in the PivotPanel control.
Then the PivotGrid control shows 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 set the source-collection attribute or the read-action-url attribute in the tag.
Otherwise, please set the service-url attribute in the tag used in the DataEngine page.

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.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));
        }
    }
}
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
31
32
33
34
35
@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{
    @Html.Partial("_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>
  
}