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;
101,100
104,835
117,144
114,564
437,643
148,214
48,851
97,689
114,114
408,868
114,928
79,821
102,865
101,244
398,858
142,355
131,690
116,737
95,752
486,534
166,327
130,823
118,616
151,627
567,393
184,198
157,573
90,022
83,657
515,450
112,956
116,979
108,122
143,906
481,963
122,865
96,820
142,218
129,736
491,639
111,012
139,989
97,578
113,254
461,833
124,848
121,493
176,007
38,541
460,889
76,775
107,771
101,210
127,171
412,927
1,405,578
1,236,645
1,268,208
1,213,566
5,123,997

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>
  
}