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;
97,341
82,890
170,810
120,434
471,475
97,591
85,576
102,569
117,476
403,212
126,196
113,738
118,288
71,081
429,303
115,133
77,413
87,776
118,139
398,461
123,155
117,537
109,305
115,263
465,260
90,251
83,053
101,002
91,274
365,580
122,894
126,145
107,787
77,524
434,350
156,419
133,719
53,179
70,854
414,171
88,986
126,117
148,379
102,089
465,571
113,675
86,467
130,100
145,988
476,230
190,122
116,306
125,626
122,778
554,832
1,321,763
1,148,961
1,254,821
1,152,900
4,878,445

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