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;
85,566
120,159
109,629
89,857
405,211
81,436
115,235
107,905
91,566
396,142
194,285
162,493
122,636
132,696
612,110
112,080
74,724
201,955
91,106
479,865
55,249
71,247
140,945
89,722
357,163
118,623
78,951
118,336
79,793
395,703
148,277
120,927
105,283
145,712
520,199
71,967
91,896
99,129
131,542
394,534
74,832
110,409
114,120
137,500
436,861
99,862
91,376
86,421
78,344
356,003
165,398
127,998
104,999
154,712
553,107
1,207,575
1,165,415
1,311,358
1,222,550
4,906,898

Settings

Description

In this sample, the PivotEngine binds to a remote action url which provides the data to be aggregated.
All the data will be transferred to the client. The PivotEngine will calculate the data at the client-side.
The PivotPanel control and the PivotGrid control are bound to the PivotEngine.
You can change the view definition in the PivotPanel control.
The PivotGrid control reflects the changes in 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 use Bind(data) or Bind(url) mode.
Otherwise, please use BindService(url) mode.

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.Web.Mvc;
using System.Linq;
using System.Collections.Generic;
 
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.DemoSettingsModel = 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
@model IEnumerable<ProductData>
@{
    ClientSettingsModel optionsModel = ViewBag.DemoSettingsModel;
}
 
@(Html.C1().PivotEngine().Id("remoteEngine")
        .Bind(Url.Action("RemoteBind_Read"))
        .RowFields(pfcb => pfcb.Items("Country"))
        .ColumnFields(cfcb => cfcb.Items("Product"))
        .ValueFields(vfcb => vfcb.Items("Sales")))
 
<div class="row">
    <div class="col-sm-4 col-md-4">
        @Html.C1().PivotPanel().Id(optionsModel.ControlId).ItemsSourceId("remoteEngine")
    </div>
    <div class="col-sm-8 col-md-8">
        @Html.C1().PivotGrid().Id("indexGrid").ItemsSourceId("remoteEngine")
    </div>
</div>
 
@section Description{
<p>@Html.Raw(Resources.Olap.RemoteBind_Text0)</p>
 
<p>@Html.Raw(Resources.Olap.RemoteBind_Text1)</p>
 
}
@section Summary{
<p>@Html.Raw(Resources.Olap.RemoteBind_Text2)</p>
 
}