-
Notifications
You must be signed in to change notification settings - Fork 77
Merge new-kb-grid-remove-group-indent-e7be6242097049588624e2b10cc4f486-2908 into production #2931
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
dimodi
merged 4 commits into
production
from
new-kb-grid-remove-group-indent-e7be6242097049588624e2b10cc4f486-2908
Apr 24, 2025
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
--- | ||
title: Removing Group Indent in Grid for Blazor | ||
description: This article demonstrates how to remove the group indent in the Grid for Blazor by overriding the default theme styles. | ||
type: how-to | ||
page_title: How to Remove Group Indentation in Blazor Grid | ||
slug: grid-kb-remove-group-indent | ||
tags: grid, blazor, grouping, indentation | ||
res_type: kb | ||
ticketid: 1684110 | ||
--- | ||
|
||
## Description | ||
|
||
This knowledge base article answers the following questions: | ||
|
||
- Is there a way to remove the group indent and adjust the spacing without compromising the Grid behavior? | ||
- How can I customize the grouping appearance in a Blazor Grid? | ||
- How to hide the group indent and group header icons in a Blazor Grid? | ||
- What is the best way to hide the expand/collapse icons of the groups headers in a Telerik Blazor Grid? | ||
|
||
## Environment | ||
|
||
<table> | ||
<tbody> | ||
<tr> | ||
<td>Product</td> | ||
<td>Grid for Blazor</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
||
## Solution | ||
|
||
To remove the group indent in the [Grid for Blazor](slug:grid-overview) and hide the expand/collapse icons of the groups, you will need to override the default theme styles. This solution involves applying custom CSS styles to the Grid component. Run the example below and group the Grid by some of the columns to see the removed group indentation: | ||
|
||
````RAZOR | ||
<TelerikGrid Data=@GridData | ||
Groupable="true" | ||
Pageable="true" | ||
Height="400px" | ||
Class="custom-grouping"> | ||
<GridColumns> | ||
<GridColumn Field=@nameof(Employee.Name) Groupable="false" /> | ||
<GridColumn Field=@nameof(Employee.Team) Title="Team" /> | ||
<GridColumn Field=@nameof(Employee.IsOnLeave) Title="On Vacation" /> | ||
</GridColumns> | ||
</TelerikGrid> | ||
|
||
<style> | ||
.custom-grouping.k-grid .k-group-col { | ||
width: 0; | ||
} | ||
|
||
.custom-grouping.k-grid .k-grouping-row .k-icon { | ||
display: none; | ||
} | ||
</style> | ||
|
||
@code { | ||
private List<Employee>? GridData { get; set; } | ||
|
||
protected override void OnInitialized() | ||
{ | ||
GridData = new List<Employee>(); | ||
var rand = new Random(); | ||
for (int i = 0; i < 15; i++) | ||
{ | ||
GridData.Add(new Employee() | ||
{ | ||
EmployeeId = i, | ||
Name = "Employee " + i.ToString(), | ||
Team = "Team " + i % 3, | ||
IsOnLeave = i % 2 == 0 | ||
}); | ||
} | ||
} | ||
|
||
public class Employee | ||
{ | ||
public int EmployeeId { get; set; } | ||
public string Name { get; set; } = string.Empty; | ||
public string Team { get; set; } = string.Empty; | ||
public bool IsOnLeave { get; set; } | ||
} | ||
} | ||
```` | ||
|
||
## See Also | ||
|
||
- [Grid Overview](slug:grid-overview) | ||
- [Override Theme Styles](slug:theme-override) | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.