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;
114,928
130,525
114,270
168,047
527,770
161,560
92,941
71,813
102,957
429,271
127,561
67,968
134,898
128,047
458,474
136,024
99,178
159,160
129,617
523,979
78,707
107,530
96,260
75,477
357,974
92,738
88,136
119,031
137,565
437,470
126,869
102,437
124,035
52,493
405,834
53,404
131,050
105,830
126,485
416,769
142,469
144,956
121,166
152,488
561,079
99,299
110,419
132,702
133,698
476,118
105,842
46,666
126,131
134,101
412,740
1,239,401
1,121,806
1,305,296
1,340,975
5,007,478

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