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;
130,256
128,251
82,608
131,043
472,158
140,889
134,305
91,200
118,786
485,180
184,790
98,135
109,724
144,100
536,749
150,661
106,812
77,417
123,661
458,551
103,077
115,194
107,521
167,036
492,828
129,049
63,268
125,674
126,422
444,413
85,111
94,157
131,519
110,941
421,728
98,128
132,699
119,627
80,193
430,647
140,957
134,450
79,157
140,256
494,820
140,374
101,605
123,932
93,799
459,710
100,696
56,880
102,488
136,039
396,103
1,403,988
1,165,756
1,150,867
1,372,276
5,092,887

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