-
Notifications
You must be signed in to change notification settings - Fork 80
Added new kb article grid-remove-group-indent #2908
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
Tsvetomir-Hr
merged 3 commits into
master
from
new-kb-grid-remove-group-indent-e7be6242097049588624e2b10cc4f486
Apr 24, 2025
Merged
Changes from 2 commits
Commits
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 also 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 adjust the appearance of grouped headers in a Blazor Grid? | ||
Tsvetomir-Hr marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ## 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 adjust the appearance of grouped headers, 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: | ||
Tsvetomir-Hr marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ````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) | ||
Oops, something went wrong.
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.