Skip to content
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

fix: DataGrid - Alignment for first column header in a sortable DataGrid is offset. #3273

Closed
garrenf opened this issue Jan 30, 2025 · 1 comment · Fixed by #3286
Closed
Labels
closed:done Work is finished

Comments

@garrenf
Copy link

garrenf commented Jan 30, 2025

Below is an image of what appears when copying the code from the demo site into my project. I've changed the header colors to bright yellow to make the issue more prominent.

<FluentDataGrid Items="@people">
    <PropertyColumn Property="@(p => p.PersonId)" Sortable="true" />
    <PropertyColumn Property="@(p => p.Name)" Sortable="true" />
    <PropertyColumn Property="@(p => p.BirthDate)" Format="yyyy-MM-dd" Sortable="true" />
</FluentDataGrid>

@code {
    record Person(int PersonId, string Name, DateOnly BirthDate);

    IQueryable<Person> people = new[]
    {
        new Person(10895, "Jean Martin", new DateOnly(1985, 3, 16)),
        new Person(10944, "António Langa", new DateOnly(1991, 12, 1)),
        new Person(11203, "Julie Smith", new DateOnly(1958, 10, 10)),
        new Person(11205, "Nur Sari", new DateOnly(1922, 4, 27)),
        new Person(11898, "Jose Hernandez", new DateOnly(2011, 5, 3)),
        new Person(12130, "Kenji Sato", new DateOnly(2004, 1, 9)),
    }.AsQueryable();
}

Notice that the first column header is nudged to the right a little bit.

Image

This is what it should look like:

Image

This does not appear to happen on the demo site and looks correct. This seems to only happen when implementing into my own project. A workaround I am using for it is to add css code:

.column-header:not(.select-all):first-of-type {
    padding-inline-start: 0 !important;
}

FluentUI 4.11.3
.NET 9

@microsoft-github-policy-service microsoft-github-policy-service bot added the triage New issue. Needs to be looked at label Jan 30, 2025
@vnbaaij vnbaaij added closed:done Work is finished and removed triage New issue. Needs to be looked at labels Feb 1, 2025
@vnbaaij
Copy link
Collaborator

vnbaaij commented Feb 1, 2025

Fixed with PR mentioned

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed:done Work is finished
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants