Skip to content
3 changes: 2 additions & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ navigation:
title: "State Management"
"*how-to":
title: "How To"
"*grid":
"*/grid":
title: "Grid"
"*gridlayout":
title: "Grid Layout"
Expand Down Expand Up @@ -479,6 +479,7 @@ intro_columns:
"Grid": "grid-overview"
"ListView": "listview-overview"
"Pager": "pager-overview"
"PivotGrid": "pivotgrid-overview"
"TreeList": "treelist-overview"
-
title: "File Management"
Expand Down
74 changes: 74 additions & 0 deletions components/pivotgrid/configurator.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---
title: Configurator
page_title: PivotGrid Configurator
description: The PivotGrid configurator allows end users to control the fields, columns, rows and values (measures), which the Telerik UI for Blazor PivotGrid will show.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
description: The PivotGrid configurator allows end users to control the fields, columns, rows and values (measures), which the Telerik UI for Blazor PivotGrid will show.
The PivotGrid configurator allows end users to control the fields, columns, rows, and values (measures), which the Telerik UI for Blazor PivotGrid will show.
slug: pivotgrid-configurator
tags: telerik,blazor,pivotgrid
published: True
position: 20
---

# PivotGrid Configurator

This article describes the appearance and behavior of the PivotGrid configurator.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This article describes the appearance and behavior of the PivotGrid configurator.
This article describes the appearance and behavior of the PivotGrid Configurator.

## Sections

The Pivot Grid Configurator contains the following sections:

* [Fields](#fields)
* [Columns](#columns-and-rows)
* [Rows](#columns-and-rows)
* [Values](#values)
* [Buttons](#buttons)


## Fields

**Fields** display in a TreeView with checkboxes. Here is how they work:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Display" requires an object.

Suggested change
**Fields** display in a TreeView with checkboxes. Here is how they work:
Fields are displayed in a TreeView with checkboxes. Here is how they work:

* The TreeView items and their checkbox state are populated automatically, based on the PivotGrid data and initial configuration.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* The TreeView items and their checkbox state are populated automatically, based on the PivotGrid data and initial configuration.
* The TreeView items and their checkbox state are populated automatically based on the PivotGrid data and initial configuration.
* Users can check and uncheck TreeView items, which will add or remove the respective Field in the Columns or Rows sections.
* If a field is defined in a `<PivotGridRow>` or `<PivotGridColumn>` tag in the Pivot Grid, then users cannot use that field in another Configurator section.
* If a field is not defined anywhere in the PivotGrid declaration, then checking a TreeView checkbox will add it as a *column field*. Then, the user can drag it to another section.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* If a field is not defined anywhere in the PivotGrid declaration, then checking a TreeView checkbox will add it as a *column field*. Then, the user can drag it to another section.
* If a field is not defined anywhere in the PivotGrid declaration, then checking a TreeView checkbox will add it as a Column field. Then, the user can drag it to another section.


## Columns and Rows

The **Columns** section of the Configurator shows all fields that are currently used as column headers.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't use bold for the terms.


The **Rows** section shows the fields that are used as row headers.

The Row and Column fields support sorting and filtering of the field values. User should click the three dots in each chip to open a context menu with these options.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The Row and Column fields support sorting and filtering of the field values. User should click the three dots in each chip to open a context menu with these options.
The Row and Column fields support sorting and filtering of the field values. The user must click the three dots in each chip to open a context menu with these options.


## Values

The **Values** section of the Configurator shows all fields that are currently used as measures (dimensions).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The **Values** section of the Configurator shows all fields that are currently used as measures (dimensions).
The Values section of the Configurator shows all fields that are currently used as measures (dimensions).


## Buttons

The bottom section of the Configurator renders *Apply* and *Cancel* buttons. End users should click them after adding or removing fields to the Columns, Rows and Values sections.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The bottom section of the Configurator renders *Apply* and *Cancel* buttons. End users should click them after adding or removing fields to the Columns, Rows and Values sections.
The bottom section of the Configurator renders **Apply** and **Cancel** buttons. End users should click them after adding or removing fields to the Columns, Rows, and Values sections.

The following user actions do not require users to click on *Apply*:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The following user actions do not require users to click on *Apply*:
The following user actions do not require users to click **Apply**:

* Reordering already added fields via dragging
* Sorting
* Filtering


## Example

Refer to the [example of a Pivot Grid using an XMLA Data Provider Type]({%slug pivotgrid-data-binding%}#xmla).


## Next Steps

* [Implement PivotGrid templates]({%slug pivotgrid-templates%})


## See Also

* [Live PivotGrid Demos](https://demos.telerik.com/blazor-ui/pivotgrid)
* [PivotGrid API Reference](/blazor-ui/api/Telerik.Blazor.Components.TelerikPivotGrid-1)
158 changes: 158 additions & 0 deletions components/pivotgrid/data-binding.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
---
title: Data Binding
page_title: PivotGrid Data Binding
description: What are the different ways to provide data to the Telerik UI for Blazor PivotGrid. Information about XMLA datasource, local data.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
description: What are the different ways to provide data to the Telerik UI for Blazor PivotGrid. Information about XMLA datasource, local data.
description: Learn what are the different ways to provide data to the Telerik UI for Blazor PivotGrid. Information about XMLA datasource, local data.
slug: pivotgrid-data-binding
tags: telerik,blazor,pivotgrid
published: True
position: 10
---

# PivotGrid Data Binding

This article describes the PivotGrid data binding mechanism and the supported data source options.


## Data Provider Type

The PivotGrid supports different data sources via its `DataProviderType` parameter. The parameter type is `PivotGridDataProviderType` enum and its members are:

* [`Local`](#local) (default)
* [`Xmla`](#xmla)


## Local

When bound to local data, the Pivot Grid requires its `Data` parameter to provide all the data at once as `IEnumerable<TItem>`. The component will perform all aggregate calculations in-memory and there is no [load on demand]({%slug pivotgrid-overview%}#pivotgrid-parameters).

> Large amounts of local data may impact the performance, especially in WebAssembly applications.

>caption PivotGrid bound to Local data provider

````CSHTML
<TelerikPivotGrid Data="@PivotData">
<PivotGridColumns>
<PivotGridColumn Name="@nameof(PivotModel.City)" />
</PivotGridColumns>
<PivotGridRows>
<PivotGridRow Name="@nameof(PivotModel.Category)" />
<PivotGridRow Name="@nameof(PivotModel.Product)" />
</PivotGridRows>
<PivotGridMeasures>
<PivotGridMeasure Name="@nameof(PivotModel.ContractValue)" />
</PivotGridMeasures>
</TelerikPivotGrid>

@code {
private List<PivotModel> PivotData { get; set; } = new List<PivotModel>();

protected override void OnInitialized()
{
var dataItemCount = 100;
var categoryCount = 3;
var productCount = 5 + 1; // effectively 5, as rnd.Next() will never return 6
var cityCount = 3 + 1; // effectively 3
var rnd = new Random();

for (int i = 1; i <= dataItemCount; i++)
{
var productNumber = rnd.Next(1, productCount);

PivotData.Add(new PivotModel()
{
Category = $"Category {productNumber % categoryCount + 1}",
Product = $"Product {productNumber}",
City = $"City {rnd.Next(1, cityCount)}",
ContractDate = DateTime.Now.AddDays(-rnd.Next(1, 31)).AddMonths(-rnd.Next(1, 12)).AddYears(-rnd.Next(0, 5)),
ContractValue = rnd.Next(123, 987)
});
}

base.OnInitialized();
}

public class PivotModel
{
public string Category { get; set; } = null!;
public string Product { get; set; } = null!;
public string City { get; set; } = null!;
public DateTime ContractDate { get; set; }
public decimal ContractValue { get; set; }
}
}
````


## Xmla

The PivotGrid supports binding to [XML for Analysis](https://learn.microsoft.com/en-us/analysis-services/xmla/xml-for-analysis-xmla-reference) data, for example an [OLAP cube](https://en.wikipedia.org/wiki/OLAP_cube). For more information about OLAP cubes, check [Just What Are Cubes Anyway? A Painless Introduction to OLAP Technology](https://learn.microsoft.com/en-us/previous-versions/office/developer/office-xp/aa140038(v=office.10)) by Microsoft.

The PivotGrid provides nested Razor components to setup the XMLA connection. Use the `<PivotGridSettings>` tag and place one or both of the following inside it:

* [`<PivotGridXmlaDataProviderSettings>`](#xmla-data-provider-settings) - configures the data server URL and database name
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use an em dash in definition lists.

* [`<PivotGridXmlaDataProviderCredentials>`](#xmla-data-provider-credentials) - configures optional access credentials

### XMLA Data Provider Settings

The `PivotGridXmlaDataProviderSettings` component exposes the following parameters.

@[template](/_contentTemplates/common/parameters-table-styles.md#table-layout)

| Parameter | Type | Description |
| --- | --- | --- |
| `Catalog` | `string` | The initial dataset (batabase) name to connect to. |
| `Cube` | `string` | The OLAP cube name. |
| `ServerUrl` | `string` | The endpoint URL that provides [HTTP access to the XMLA Analysis Services](https://learn.microsoft.com/en-us/analysis-services/instances/configure-http-access-to-analysis-services-on-iis-8-0). If the endpoint is on a different domain, make sure to [configure CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS). |

>tip Setting up an OLAP cube is outside the scope of this documentation. You can start from [SQL Server Analysis Services](https://learn.microsoft.com/en-us/analysis-services/ssas-overview).

### XMLA Data Provider Credentials

The `<PivotGridXmlaDataProviderCredentials>` component creates an object, which is similar to [`System.Net.NetworkCredential`](https://learn.microsoft.com/en-us/dotnet/api/system.net.networkcredential) and works in a similar way. It has the following parameters.

| Parameter | Type | Description |
| --- | --- | --- |
| `Domain` | `string` | (optional) The domain, which verifies the credentials. |
| `Password` | `string` | The password for the provided `Username`. |
| `Username` | `string` | The user that requests access to the XMLA data. |

### XMLA Data Binding Example

>caption PivotGrid bound to XMLA data provider without credentials

````CSHTML
<TelerikPivotGridContainer>
<TelerikPivotGridConfigurator />

<TelerikPivotGridConfiguratorButton />

<TelerikPivotGrid DataProviderType="@PivotGridDataProviderType.Xmla"
TItem="object">
<PivotGridSettings>
<PivotGridXmlaDataProviderSettings ServerUrl="https://demos.telerik.com/olap/msmdpump.dll"
Catalog="Adventure Works DW 2008R2"
Cube="Adventure Works" />
</PivotGridSettings>

<PivotGridRows>
<PivotGridRow Name="[Product].[Category]"></PivotGridRow>
<PivotGridRow Name="[Product].[Model Name]"></PivotGridRow>
</PivotGridRows>

<PivotGridColumns>
<PivotGridColumn Name="[Date].[Calendar Quarter of Year]"></PivotGridColumn>
<PivotGridColumn Name="[Date].[Calendar Year]"></PivotGridColumn>
</PivotGridColumns>

<PivotGridMeasures>
<PivotGridMeasure Name="[Measures].[Reseller Order Count]"></PivotGridMeasure>
</PivotGridMeasures>
</TelerikPivotGrid>
</TelerikPivotGridContainer>
````

## See Also

* [Live PivotGrid Demos - Local Data Binding](https://demos.telerik.com/blazor-ui/pivotgrid/local-data-binding)
* [Live PivotGrid Demos - OLAP (XMLA) Data Binding](https://demos.telerik.com/blazor-ui/pivotgrid/xmla-data-binding)
* [PivotGrid API Reference](/blazor-ui/api/Telerik.Blazor.Components.TelerikPivotGrid-1)
Loading