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;
99,114
111,522
78,353
131,321
420,310
103,713
116,668
147,688
75,536
443,605
91,010
54,439
100,152
110,277
355,878
65,328
92,238
113,435
112,404
383,405
128,277
93,360
119,391
104,360
445,388
115,435
79,224
88,141
103,727
386,527
85,442
133,026
120,815
109,654
448,937
137,255
146,479
159,759
105,574
549,067
131,578
61,711
99,318
125,556
418,163
151,058
120,002
115,768
86,099
472,927
73,392
105,904
150,868
100,071
430,235
1,181,602
1,114,573
1,293,688
1,164,579
4,754,442

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