OLAP allows you to retrieve data directly using C1JSONRequest. This specifies remote data URLs that include the server, table and columns. The arrays returned are used as data sources for CollectionView objects.
CollectionViewHelper
is a static class that enables collections to have editing, filtering, grouping, and sorting services. The Bind
property of PivotEngine is used to bind it to a collection by passing an action URL method to carry out a specific operation. This class also includes the following methods:
Read()
: Retrieves data from the collection.Edit()
: Enables excel-style editing in OLAP.BatchEdit()
: Allows editing multiple items at a time.This topic comprises of three steps:
Create a new class inside the Models folder to create data source for the OLAP control.
ProductData.cs
). See Adding controls to know how to add a new model.Create a Controller and View for OLAP control and follow the below steps to initialize an OLAP control.
Complete the following steps to initialize an OLAP control.
Add a new Controller
OlapController
).OlapController.
Index()
.Razor |
Copy Code
|
---|---|
@using RemoteDataOlap.Models; @model IEnumerable<ProductData> <c1-pivot-engine id="remoteEngine"> <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> <c1-pivot-panel items-source-id="remoteEngine"></c1-pivot-panel> <c1-pivot-grid items-source-id="remoteEngine"></c1-pivot-grid> |
The following image shows how OLAP control appears in the browser after completing the above steps: