Class PivotViewGridSettings
Specifies options for customizing rows, columns, value cells, and cell content in the pivot table.
Inherited Members
Namespace: Syncfusion.Blazor.PivotView
Assembly: Syncfusion.Blazor.dll
Syntax
public class PivotViewGridSettings : SfOwningComponentBase, IComponent, IHandleEvent, IHandleAfterRender, IDisposable
Remarks
The following options are available to customize the pivot table:
- Height — Specifies the height of the pivot table content to be set, meaning that the height given is applied without considering the column headers in the pivot table.
- Width — Specifies the width of the pivot table. Note: The pivot table will not display less than 400px, as it is the minimum width for the component.
-
GridLines — Specifies options for customizing the cell borders of each cell displayed in the pivot table.
For example, to display a pivot table without cell borders, set the property
GridLinesto None. - AllowTextWrap — Enables the contents of the cells to be wrapped when the content exceeds the width of the cells in the pivot table.
-
TextWrapSettings — Specifies options to wrap either column and row headers or values or both headers and cell content.
For example, to enable the wrap option for value cells alone, set the property
WrapModeto Content in the PivotViewTextWrapSettings class. - AllowReordering — Enables reordering of a specific column header from one index to another index in the pivot table by drag-and-drop.
- AllowResizing — Enables the columns to be resized by clicking and dragging the right edge of the column headers.
- RowHeight — Specifies the height to be set for the pivot table rows uniformly.
- ColumnWidth — Specifies the width to be set for the pivot table columns uniformly.
-
ClipMode — Specifies how the contents of cell overflow are displayed in the pivot table.
For example, to truncate the cell content when it overflows with respect to its cell width, set the property
ClipModeto Clip. - AllowSelection — Enables a row or column or cell to be highlighted by simply clicking or using arrow keys in the pivot table.
-
SelectionSettings — Specifies a set of options to customize the selection of a row or column or cell by simply clicking or using arrow keys in the pivot table.
For example, to highlight both rows and columns with multiple selection, set the properties
Modeto Both andTypeto Multiple in the PivotViewSelectionSettings class. -
SelectedRowIndex — Specifies a specific row in the pivot table to be highlighted during initial rendering. For example, to highlight the pivot table's first row, set the property
SelectedRowIndexto 0. - ContextMenuItems — Specifies built-in context menu items with pre-defined menu options or custom menu options to be shown by right-clicking on the pivot table cell.
Constructors
PivotViewGridSettings()
Declaration
public PivotViewGridSettings()
Properties
AllowReordering
Gets or sets a value that enables drag-and-drop reordering of column headers within the same hierarchy level.
Declaration
[Parameter]
[JsonPropertyName("allowReordering")]
public bool AllowReordering { get; set; }
Property Value
| Type | Description |
|---|---|
| bool | A bool indicating whether column header reordering is enabled. The default value is false. |
Remarks
Reordering is limited to headers at the same level on the column axis. It does not change the field order defined in Columns and affects only the visual order of members, not sorting configured via SortSettings.
Examples
The following example demonstrates how to enable column reordering in a Pivot Table:
<SfPivotView TValue="PivotProductDetails" Height="340">
<PivotViewGridSettings AllowReordering="true"></PivotViewGridSettings>
</SfPivotView>
See Also
AllowResizing
Gets or sets a value that indicates whether columns can be resized by dragging the edge of column header cells. In right-to-left (RTL) layouts, resizing is performed from the left edge of the header cell.
Declaration
[Parameter]
[JsonPropertyName("allowResizing")]
public bool AllowResizing { get; set; }
Property Value
| Type | Description |
|---|---|
| bool | A bool that indicates whether column resizing is enabled. The default value is true. |
Remarks
When enabled, column widths can be adjusted interactively at runtime. Resizing affects visual layout only and may trigger a re-render of the grid. Consider performance implications when many columns are present.
Examples
The following example demonstrates how to enable column resizing in a Pivot Table:
<SfPivotView TValue="ProductDetails" Width="800px" Height="450px">
<PivotViewDataSourceSettings DataSource="@data">
<!-- Configure rows, columns, values, and filters -->
</PivotViewDataSourceSettings>
<PivotViewGridSettings AllowResizing="true"></PivotViewGridSettings>
</SfPivotView>
See Also
AllowSelection
Gets or sets a value that indicates whether selection of rows, columns, or cells is enabled. Selection can be performed using mouse or keyboard navigation.
Declaration
[Parameter]
[JsonPropertyName("allowSelection")]
public bool AllowSelection { get; set; }
Property Value
| Type | Description |
|---|---|
| bool | A bool indicating whether selection is enabled. The default value is false. |
Remarks
Selection behavior is configured via SelectionSettings, including selection mode, type, and persistence. This property affects client-side interaction and should be set on the UI thread in Blazor components.
Examples
<SfPivotView TValue="ProductDetails" Width="800px" Height="450px">
<PivotViewDataSourceSettings DataSource="@data">
<!-- Configure rows, columns, values, and filters -->
</PivotViewDataSourceSettings>
<PivotViewGridSettings AllowSelection="true">
<PivotViewSelectionSettings Type=PivotTableSelectionType.Multiple></PivotViewSelectionSettings>
</PivotViewGridSettings>
</SfPivotView>
See Also
AllowTextWrap
Gets or sets a value that indicates whether cell content wraps when it exceeds the column width.
Declaration
[Parameter]
[JsonPropertyName("allowTextWrap")]
public bool AllowTextWrap { get; set; }
Property Value
| Type | Description |
|---|---|
| bool | A bool indicating whether text wrapping is enabled. The default value is false. |
Remarks
Wrapping behavior can be further customized using TextWrapSettings to target headers, values, or both.
Examples
<SfPivotView TValue="ProductDetails" Width="800px" Height="450px">
<PivotViewDataSourceSettings DataSource="@data">
<!-- Configure rows, columns, values, and filters -->
</PivotViewDataSourceSettings>
<PivotViewGridSettings AllowTextWrap="true"></PivotViewGridSettings>
</SfPivotView>
AutoFit
Gets or sets a value that indicates whether the grid automatically fits column widths within the available space.
Declaration
[Parameter]
[JsonPropertyName("autoFit")]
public bool AutoFit { get; set; }
Property Value
| Type | Description |
|---|---|
| bool | A bool indicating whether automatic column fitting is enabled. The default value is true. |
Remarks
When true, the grid distributes available width across columns to reduce horizontal scrolling. Explicit widths and interactively resized columns may override automatic sizing. Changing this property triggers a layout update.
Examples
<SfPivotView TValue="ProductDetails" Width="800px" Height="450px">
<PivotViewDataSourceSettings DataSource="@data">
<!-- Configure rows, columns, values, and filters -->
</PivotViewDataSourceSettings>
<PivotViewGridSettings AutoFit="true"></PivotViewGridSettings>
</SfPivotView>
ClipMode
Gets or sets how overflowing cell content is displayed.
Declaration
[Parameter]
[JsonPropertyName("clipMode")]
public PivotTableClipMode ClipMode { get; set; }
Property Value
| Type | Description |
|---|---|
| PivotTableClipMode | A PivotTableClipMode specifying the overflow behavior. The default value is Ellipsis. |
Remarks
The following modes are available:
- Clip - Truncates content to the cell bounds without adornment.
- Ellipsis - Shows an ellipsis when content overflows.
- EllipsisWithTooltip - Shows an ellipsis and displays a tooltip on hover.
Examples
The following example demonstrates how to set the clip mode in a Pivot Table:
<SfPivotView TValue="PivotProductDetails" Height="340">
<PivotViewDataSourceSettings DataSource="@data">
<!-- Configure rows, columns, values, and filters -->
</PivotViewDataSourceSettings>
<PivotViewGridSettings ClipMode=Syncfusion.Blazor.PivotView.PivotTableClipMode.Clip></PivotViewGridSettings>
</SfPivotView>
See Also
ColumnWidth
Gets or sets the common width, in pixels, applied to columns.
Declaration
[Parameter]
[JsonPropertyName("columnWidth")]
public double ColumnWidth { get; set; }
Property Value
| Type | Description |
|---|---|
| double | A double specifying the column width in pixels. The default value is |
Remarks
The first column (row headers) uses 250 pixels with the grouping bar and 200 pixels without it. Interactive resizing at runtime can override this value.
Examples
The following example demonstrates how to set column width in a Pivot Table:
<SfPivotView TValue="PivotProductDetails" Height="340">
<PivotViewGridSettings ColumnWidth="150"></PivotViewGridSettings>
</SfPivotView>
ContextMenuItems
Gets or sets the collection of built-in or custom context menu items shown when right-clicking a pivot cell.
Declaration
[Parameter]
[JsonPropertyName("contextMenuItems")]
public List<PivotTableContextMenuItem> ContextMenuItems { get; set; }
Property Value
| Type | Description |
|---|---|
| List<PivotTableContextMenuItem> | A List<T> of PivotTableContextMenuItem values representing the menu items. The default value is an empty collection. |
Remarks
Supported built-in items include:
Drillthrough- Opens a drill-through dialog to view underlying records.Expand- Expands collapsed row or column headers.Collapse- Collapses expanded row or column headers.CalculatedField- Opens the calculated field dialog.Pdf Export- Exports the pivot to PDF.Excel Export- Exports the pivot to Excel.Csv Export- Exports the pivot to CSV.Sort Ascending- Sorts by the selected cell's row or column values in ascending order.Sort Descending- Sorts by the selected cell's row or column values in descending order.Aggregate- Performs aggregations on value fields.
Examples
The following example demonstrates how to set the context menu items in a Pivot Table:
<SfPivotView TValue="PivotProductDetails" Height="340">
<PivotViewGridSettings>
<ContextMenuItems>
<PivotTableContextMenuItem>Expand</PivotTableContextMenuItem>
<PivotTableContextMenuItem>Collapse</PivotTableContextMenuItem>
</ContextMenuItems>
</PivotViewGridSettings>
</SfPivotView>
GridLines
Gets or sets the visibility of grid lines (cell borders) in the pivot table.
Declaration
[Parameter]
[JsonPropertyName("gridLines")]
public PivotTableGridLine GridLines { get; set; }
Property Value
| Type | Description |
|---|---|
| PivotTableGridLine | A PivotTableGridLine value that determines which grid lines are shown. The default value is Both. |
Remarks
Available options:
- Both - Shows both horizontal and vertical lines.
- None - Hides all grid lines.
- Horizontal - Shows horizontal lines only.
- Vertical - Shows vertical lines only.
- Default - Uses theme defaults.
Examples
The following example demonstrates how to set the grid lines in a Pivot Table:
<SfPivotView TValue="PivotProductDetails" Height="340">
<PivotViewGridSettings GridLines="PivotTableGridLine.Both"></PivotViewGridSettings>
</SfPivotView>
See Also
Height
Gets or sets the height of the pivot table content area, excluding column headers.
Declaration
[Parameter]
[JsonPropertyName("height")]
public string Height { get; set; }
Property Value
| Type | Description |
|---|---|
| string | A string representing a CSS length (for example, |
Remarks
Accepts any valid CSS length unit. When set to "auto", the component sizes to fit content.
Examples
The following example demonstrates how to set height in a Pivot Table:
<SfPivotView TValue="PivotProductDetails" Height="340">
<PivotViewGridSettings Height="400px"></PivotViewGridSettings>
</SfPivotView>
Layout
Gets or sets the layout format used to render the pivot table.
Declaration
[Parameter]
[JsonPropertyName("layout")]
[JsonConverter(typeof(JsonStringEnumConverter))]
public PivotLayout Layout { get; set; }
Property Value
| Type | Description |
|---|---|
| PivotLayout | A PivotLayout value that determines whether the pivot table is displayed in a compact or tabular layout.
The default is |
Remarks
This property is applicable only for relational data source.
Use PivotLayout.Compact for a condensed view where row headers are merged into a single column, similar to Excel's default pivot layout.
Use PivotLayout.Tabular for a classic layout where each row header appears in its own column, enhancing readability for hierarchical data.
Changing this property will re-render the pivot table with the selected layout.
Examples
The following example configures the pivot table to use the Tabular layout:
<SfPivotView TValue="PivotProductDetails" Height="340">
<PivotViewGridSettings Layout="PivotLayout.Tabular"></PivotViewGridSettings>
</SfPivotView>
PrintMode
Gets or sets the print scope for the pivot table.
Declaration
[Parameter]
[JsonPropertyName("printMode")]
public PivotTablePrintMode PrintMode { get; set; }
Property Value
| Type | Description |
|---|---|
| PivotTablePrintMode | A PivotTablePrintMode value indicating whether to print all pages or only the current page. No default value. |
Remarks
Available options include printing the entire pivot or only the currently visible page.
Examples
The following example demonstrates how to set print mode in a Pivot Table:
<SfPivotView TValue="PivotProductDetails" Height="340">
<PivotViewGridSettings PrintMode="PivotTablePrintMode.CurrentPage"></PivotViewGridSettings>
</SfPivotView>
RowHeight
Gets or sets the common row height, in pixels.
Declaration
[Parameter]
[JsonPropertyName("rowHeight")]
public double RowHeight { get; set; }
Property Value
| Type | Description |
|---|---|
| double | A double representing the row height in pixels. The default value is |
Remarks
Column header height may vary when the grouping bar is enabled. Typical defaults are 36 px (desktop) and 48 px (mobile).
Examples
The following example demonstrates how to set row height in a Pivot Table:
<SfPivotView TValue="PivotProductDetails" Height="340">
<PivotViewGridSettings RowHeight="40"></PivotViewGridSettings>
</SfPivotView>
See Also
SelectedRowIndex
Gets or sets the zero-based index of the row to select initially.
Declaration
[Parameter]
[JsonPropertyName("selectedRowIndex")]
public double SelectedRowIndex { get; set; }
Property Value
| Type | Description |
|---|---|
| double | A double representing the initial selected row index. The default value is |
Remarks
Use 0 to select the first row. The current selection index can be read at runtime from the component instance.
Examples
The following example demonstrates how to set selected row index in a Pivot Table:
<SfPivotView TValue="PivotProductDetails" Height="340">
<PivotViewGridSettings SelectedRowIndex="2"></PivotViewGridSettings>
</SfPivotView>
SelectionSettings
Gets or sets selection behavior settings for rows, columns, and cells.
Declaration
[Parameter]
[JsonPropertyName("selectionSettings")]
public PivotViewSelectionSettings SelectionSettings { get; set; }
Property Value
| Type | Description |
|---|---|
| PivotViewSelectionSettings | A PivotViewSelectionSettings instance that configures selection mode, type, persistence, and related options. The default value is a new PivotViewSelectionSettings instance. |
Remarks
This object controls options such as Mode, CellSelectionMode, Type, CheckboxOnly, PersistSelection,
CheckboxMode, and EnableSimpleMultiRowSelection.
Examples
The following example demonstrates how to set selection settings in a Pivot Table:
<SfPivotView TValue="PivotProductDetails" Height="340">
<PivotViewGridSettings>
<SelectionSettings Mode="PivotViewSelectionMode.Row" Type="PivotViewSelectionType.Multiple"></SelectionSettings>
</PivotViewGridSettings>
</SfPivotView>
TextWrapSettings
Gets or sets text wrapping configuration for headers and value cells.
Declaration
[Parameter]
[JsonPropertyName("textWrapSettings")]
public PivotViewTextWrapSettings TextWrapSettings { get; set; }
Property Value
| Type | Description |
|---|---|
| PivotViewTextWrapSettings | A PivotViewTextWrapSettings instance that defines where wrapping is applied. The default value is a new PivotViewTextWrapSettings instance. |
Remarks
Use this setting with AllowTextWrap to enable wrapping and target headers, content, or both.
Width
Gets or sets the overall width of the pivot table.
Declaration
[Parameter]
[JsonPropertyName("width")]
public string Width { get; set; }
Property Value
| Type | Description |
|---|---|
| string | A string representing a CSS length (for example, |
Remarks
The component does not render below 400 px width.
Examples
The following example demonstrates how to set width in a Pivot Table:
<SfPivotView TValue="PivotProductDetails" Height="340">
<PivotViewGridSettings Width="600px"></PivotViewGridSettings>
</SfPivotView>
Methods
BuildRenderTree(RenderTreeBuilder)
Declaration
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters
| Type | Name | Description |
|---|---|---|
| RenderTreeBuilder | __builder |
Overrides
Dispose()
Dispose the unmanaged resources.
Declaration
public virtual void Dispose()
Dispose(bool)
Dispose unmanaged resources in the component.
Declaration
protected override void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | disposing | Boolean value to dispose the object. |
Overrides
OnInitializedAsync()
Method invoked when the component is ready to start, having received its initial parameters from its parent in the render tree. Override this method if you will perform an asynchronous operation and want the component to refresh when that operation is completed.
Declaration
protected override Task OnInitializedAsync()
Returns
| Type | Description |
|---|---|
| Task | A System.Threading.Tasks.Task representing any asynchronous operation. |
Overrides
OnParametersSetAsync()
Method invoked when the component has received parameters from its parent in the render tree, and the incoming values have been assigned to properties.
Declaration
protected override Task OnParametersSetAsync()
Returns
| Type | Description |
|---|---|
| Task | A System.Threading.Tasks.Task representing any asynchronous operation. |