Class GridGroupSettings
Configures grid grouping.
Inheritance
Inherited Members
Namespace: Syncfusion.Blazor.Grids
Assembly: Syncfusion.Blazor.dll
Syntax
public class GridGroupSettings : SfDataBoundComponent, IComponent, IHandleEvent, IHandleAfterRender, IDisposable
Constructors
GridGroupSettings()
Declaration
public GridGroupSettings()
Properties
AllowReordering
If AllowReordering is set to true, Grid allows the grouped elements to be reordered.
Declaration
[Parameter]
public bool AllowReordering { get; set; }
Property Value
| Type |
|---|
| bool |
CaptionTemplate
The Caption Template allows user to display custom group caption.
Declaration
[Parameter]
[JsonIgnore]
public RenderFragment<object> CaptionTemplate { get; set; }
Property Value
| Type |
|---|
| RenderFragment<object> |
Remarks
The parameters passed to the templates can be accessed using implicit parameter named context.
The context is of type CaptionTemplateContext of the grid.
Columns
Specifies the column names to group at initial rendering of the Grid. You can also get the currently grouped columns.
Declaration
[Parameter]
public string[] Columns { get; set; }
Property Value
| Type |
|---|
| string[] |
DisablePageWiseAggregates
If DisablePageWiseAggregates set to true, then the group aggregate value will be calculated from the whole data instead of paged data and two requests will be made for each page when Grid bound with remote service.
Declaration
[Parameter]
public bool DisablePageWiseAggregates { get; set; }
Property Value
| Type |
|---|
| bool |
EnableLazyLoading
The Lazy load grouping, allows the Grid to render only the initial level caption rows in collapsed state while grouping. The child rows of each caption will render only when we expand the captions.
Declaration
[Parameter]
public bool EnableLazyLoading { get; set; }
Property Value
| Type |
|---|
| bool |
ExpandAllGroups
Gets or sets a value that specifies whether all groups in the grid are expanded by default during the initial render, when row virtualization is enabled.
Declaration
[Parameter]
[JsonIgnore]
public bool ExpandAllGroups { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
|
Remarks
This property only affects the grid if EnableVirtualization is set to true.
If EnableLazyLoading is true, this property is ignored, and groups are not auto expanded.
Performance Note: Expanding all groups on large, virtualized datasets may have a noticeable impact on grid rendering performance.
Consider leaving this property as false to optimize load times with large data sources.
See Also
PersistGroupState
Gets or sets a value indicating whether the expand or collapse state of grouped rows is retained during SfGrid<TValue> operations such as sorting, filtering, paging, editing, and Refresh(bool).
Declaration
[Parameter]
[JsonIgnore]
public bool PersistGroupState { get; set; }
Property Value
| Type | Description |
|---|---|
| bool | A bool indicating whether the expand or collapse state of grouped rows is preserved during SfGrid<TValue> operations. The default value is false. |
Remarks
When set to true, the SfGrid<TValue> preserves the expanded or collapsed state of groups using a GroupKey. The GroupKey represents the common value under which rows are grouped, such as a specific CustomerID when grouping by that column. For example, if grouped by CustomerID with a value of ALFKI, all rows with CustomerID = ALFKI are grouped under the header Customer ID: ALFKI, and their expand or collapse state is retained after operations like sorting or filtering.
The expand or collapse state is reset when grouping or ungrouping actions are performed, as these actions alter the grid's grouping structure.
Grouping state persistence is distinct from grid persistence. While EnablePersistence may preserve other grid settings across sessions, PersistGroupState does not maintain the grouping state when the browser page is reloaded, navigated, or when the data source is dynamically changed.
Performance note: Enabling this feature may increase memory usage for large datasets due to the storage of group states.
Examples
Demonstrates how to enable PersistGroupState to retain the expand or collapse state of grouped rows in a SfGrid<TValue>.
<SfGrid DataSource="@Orders" AllowGrouping="true" AllowSorting="true">
<GridGroupSettings PersistGroupState="true" Columns="@(new string[] { 'CustomerID' })">
</GridGroupSettings>
</SfGrid>
@code {
public List<Order> Orders { get; set; } = new List<Order>
{
new Order { CustomerID = "ALFKI", OrderID = 1001 },
new Order { CustomerID = "ALFKI", OrderID = 1002 },
new Order { CustomerID = "BENDR", OrderID = 1003 }
};
public class Order
{
public string CustomerID { get; set; }
public int OrderID { get; set; }
}
}
ShowDropArea
If ShowDropArea is set to true, the group drop area element will be visible at the top of the Grid.
Declaration
[Parameter]
public bool ShowDropArea { get; set; }
Property Value
| Type |
|---|
| bool |
ShowGroupedColumn
If ShowGroupedColumn is set to false, it hides the grouped column after grouping.
Declaration
[Parameter]
public bool ShowGroupedColumn { get; set; }
Property Value
| Type |
|---|
| bool |
ShowToggleButton
If ShowToggleButton set to true, then the toggle button will be showed in the column headers which can be used to group or ungroup columns by clicking them.
Declaration
[Parameter]
public bool ShowToggleButton { get; set; }
Property Value
| Type |
|---|
| bool |
ShowUngroupButton
If ShowUngroupButton set to false, then ungroup button is hidden in dropped element. It can be used to ungroup the grouped column when click on ungroup button.
Declaration
[Parameter]
public bool ShowUngroupButton { get; set; }
Property Value
| Type |
|---|
| bool |
Methods
BuildRenderTree(RenderTreeBuilder)
Declaration
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters
| Type | Name | Description |
|---|---|---|
| RenderTreeBuilder | __builder |
Overrides
OnInitializedAsync()
Method invoked when the component is ready to start.
Declaration
protected override Task OnInitializedAsync()
Returns
| Type | Description |
|---|---|
| Task | A System.Threading.Tasks.Task representing any asynchronous operation. |
Overrides
OnParametersSetAsync()
Declaration
protected override Task OnParametersSetAsync()
Returns
| Type |
|---|
| Task |