Available in the Full Version
Pivot Grid - Remote Provider
This sample demonstrates a key benefit of using the remote provider feature of the igOlapXmlaDataSource: less network traffic.
This sample uses CTP (Community Technical Preview) features. The API and behavior may change when these features are released with full support.
Direct XMLA Access
Uploaded: 0KB, Downloaded: 0 KB
Remote XMLA Access
Uploaded: 0KB, Downloaded: 0 KB
This sample is designed for a larger screen size.
On mobile, try rotating your screen, view full size, or email to another device.
All requests are proxied through the server application to avoid cross-domain problems. In addition, the data is translated to JSON, reducing the size of the response. NOTE: This sample requires an internet connection to access the OLAP data.
Code View
Copy to Clipboard
@using Infragistics.Web.Mvc @using IgniteUI.SamplesBrowser.Models <!DOCTYPE html> <html> <head> <title></title> <!-- Ignite UI for jQuery Required Combined CSS Files --> <link href="http://cdn-na.infragistics.com/igniteui/2024.1/latest/css/themes/infragistics/infragistics.theme.css" rel="stylesheet" /> <link href="http://cdn-na.infragistics.com/igniteui/2024.1/latest/css/structure/infragistics.css" rel="stylesheet" /> <script src="http://ajax.aspnetcdn.com/ajax/modernizr/modernizr-2.8.3.js"></script> <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script> <script src="http://code.jquery.com/ui/1.11.1/jquery-ui.min.js"></script> <!-- Ignite UI for jQuery Required Combined JavaScript Files --> <script src="http://cdn-na.infragistics.com/igniteui/2024.1/latest/js/infragistics.core.js"></script> <script src="http://cdn-na.infragistics.com/igniteui/2024.1/latest/js/infragistics.lob.js"></script> </head> <body> <script type="text/javascript"> $.support.cors = true; $(function () { var dataSource, remoteDataSource, remoteSize = { u: 0, d: 0 }, directSize = { u: 0, d: 0 }, $directGrid = $("#directPivotGrid"), $remoteGrid = $("#remotePivotGrid"), toggleTupleMember = function (expand, pivotGrid, axisName, tupleIndex, memberIndex) { var friendlyAxisName = axisName == "Axis0" ? "columnAxis" : "rowAxis"; if (expand) { pivotGrid.igPivotGrid("expandTupleMember", friendlyAxisName, tupleIndex, memberIndex, true); } else { pivotGrid.igPivotGrid("collapseTupleMember", friendlyAxisName, tupleIndex, memberIndex, true); } }; $(document).ajaxComplete(function (event, request, settings) { if (settings.url.match("(.*/)?remote-xmla-provider-endpoint(.*)")) { remoteSize.u += settings.data.length; remoteSize.d += request.responseText.length; $("#remoteSize").text("Uploaded: " + (remoteSize.u / 1024).toFixed(2) + " KB, Downloaded: " + (remoteSize.d / 1024).toFixed(2) + " KB").show(); } else if (settings.url === "https://sampledata.infragistics.com/olap/msmdpump.dll") { directSize.u += settings.data.length; directSize.d += request.responseText.length; $("#directSize").text("Uploaded: " + (directSize.u / 1024).toFixed(2) + " KB, Downloaded: " + (directSize.d / 1024).toFixed(2) + " KB").show(); } }); dataSource = new $.ig.OlapXmlaDataSource({ serverUrl: 'https://sampledata.infragistics.com/olap/msmdpump.dll', catalog: 'Adventure Works DW Standard Edition', cube: 'Adventure Works', rows: '[Date].[Calendar]', columns: '[Product].[Product Categories]', measures: '[Measures].[Internet Order Count]' }); remoteDataSource = new $.ig.OlapXmlaDataSource({ isRemote: true, serverUrl: '@Url.Action("remote-xmla-provider-endpoint")', catalog: 'Adventure Works DW Standard Edition', cube: 'Adventure Works', rows: '[Date].[Calendar]', columns: '[Product].[Product Categories]', measures: '[Measures].[Internet Order Count]' }); $directGrid.igPivotGrid({ dataSource: dataSource, width: "915px", height: "450px", hideFiltersDropArea: true, disableColumnsDropArea: true, disableRowsDropArea: true, disableMeasuresDropArea: true, tupleMemberExpanding: function (evt, ui) { toggleTupleMember(true, $remoteGrid, ui.axisName, ui.tupleIndex, ui.memberIndex); }, tupleMemberCollapsing: function (evt, ui) { toggleTupleMember(false, $remoteGrid, ui.axisName, ui.tupleIndex, ui.memberIndex); } }); $remoteGrid.igPivotGrid({ dataSource: remoteDataSource, width: "915px", height: "450px", hideFiltersDropArea: true, disableColumnsDropArea: true, disableRowsDropArea: true, disableMeasuresDropArea: true, tupleMemberExpanding: function (evt, ui) { toggleTupleMember(true, $directGrid, ui.axisName, ui.tupleIndex, ui.memberIndex); }, tupleMemberCollapsing: function (evt, ui) { toggleTupleMember(false, $directGrid, ui.axisName, ui.tupleIndex, ui.memberIndex); } }); }); </script> <h5>Direct XMLA Access</h5> <h5 id="directSize">Uploaded: 0KB, Downloaded: 0 KB</h5> <div id="directPivotGrid"></div> <h5>Remote XMLA Access</h5> <h5 id="remoteSize">Uploaded: 0KB, Downloaded: 0 KB</h5> <div id="remotePivotGrid"></div> </body> </html>
using System.Web.Mvc; using Infragistics.Web.Mvc; using IgniteUI.SamplesBrowser.Application.Data; using System.Data; using System.Data.SqlClient; using IgniteUI.SamplesBrowser.Models.Repositories; using Newtonsoft.Json.Converters; using System.Linq; using System; namespace IgniteUI.SamplesBrowser.Controllers { public class PivotGridController : Controller { [AdomdDataSourceAction] [ActionName("adomd-provider-endpoint")] public ActionResult RemoteAdomdProviderEndpoint() { return View(new AdomdDataSourceModel() { ConnectionString = "Provider=MSOLAP.4;Persist Security Info=True;Data Source=http://sampledata.infragistics.com/olap/msmdpump.dll;Initial Catalog=Adventure Works DW Standard Edition;MDX Compatibility=1;Safety Options=2;MDX Missing Member Mode=Error" }); } [ActionName("remote-adomd-provider")] public ActionResult AdomdProvider() { return View("remote-adomd-provider"); } [XmlaDataSourceAction] [ActionName("remote-xmla-provider-endpoint")] public ActionResult RemoteXmlaProviderEndpoint() { return View(new XmlaDataSourceModel { ServerUrl = "http://sampledata.infragistics.com/olap/msmdpump.dll" }); } [ActionName("remote-xmla-provider")] public ActionResult RemoteXmlaProvider() { return View("remote-xmla-provider"); } [ActionName("using-the-asp-net-mvc-helper-with-flat-data-source")] public ActionResult UsingAspNetMvcHelperWithFlatDataSource() { var invoices = RepositoryFactory.GetInvoiceRepository().Get().Take(200).Select(invoice => new { Address = invoice.Address, City = invoice.City, CustomerName = invoice.CustomerName, Discount = invoice.Discount, Freight = invoice.Freight, OrderDate = invoice.OrderDate == null ? null : invoice.OrderDate.Value.AddYears(16).ToShortDateString(), ProductName = invoice.ProductName, Quantity = invoice.Quantity, RequiredDate = invoice.RequiredDate == null ? null : invoice.RequiredDate.Value.AddYears(16).ToShortDateString(), Salesperson = invoice.Salesperson, ShipCountry = invoice.ShipCountry, ShippedDate = invoice.ShippedDate == null ? null : invoice.ShippedDate.Value.AddYears(16).ToShortDateString(), ShipperName = invoice.ShipperName }); return View("using-the-asp-net-mvc-helper-with-flat-data-source", invoices); } [ActionName("using-the-asp-net-mvc-helper-with-xmla-data-source")] public ActionResult UsingAspNetMvcHelperWithXmlaDataSource() { return View("using-the-asp-net-mvc-helper-with-xmla-data-source"); } } }