Autofit doesn't work when GridForeignColumn is used

                            <TabItem>
                                <HeaderTemplate>
                                    <label Class="col-form-label-sm fw-bold">Contatti</label>
                                </HeaderTemplate>
                                <ContentTemplate>
                                    <div class="card" style="margin-bottom:5px; padding:5px; height:60vh;">
                                        <div class="card-header fw-bold" style="padding: 6px">
                                            <div class="container-fluid">
                                                <div class="row">@loc.Localize("Anag.ContattiTitle")</div>
                                            </div>
                                        </div>
                                        <div class="card-body" style="padding: 3px">
                                            <SfGrid name="gridContatti" @ref="ContattiGrid" DataSource="@contList" Width="100%" Toolbar="@(new List<string>() { "Add", "Edit", "Delete" })" Locale="it" AllowResizing="true">
                                                <GridEditSettings AllowAdding="true" AllowDeleting="true" AllowEditing="true" Mode="EditMode.Dialog"></GridEditSettings>
                                                <GridEvents OnActionBegin="CL_OnActionBeginHandler" TValue="Contatto"></GridEvents>
                                                <GridColumns>
                                                    <GridColumn Field=@nameof(Contatto.ID) Visible="false" HeaderText="ID" IsPrimaryKey="true" Width="40"></GridColumn>
                                                    <GridForeignColumn Field=@nameof(Contatto.TipoContatto) HeaderText="Tipo Contatto"
                                                                       ForeignDataSource="@tipiContatto"
                                                                       ForeignKeyField="EID"
                                                                       ForeignKeyValue="descr"
                                                                       EditType="EditType.DropDownEdit"
                                                                       MinWidth="150" Autofit></GridForeignColumn>
                                                    <GridColumn Field=@nameof(Contatto.Nominativo) HeaderText="Nominativo" Type="ColumnType.String" AutoFit></GridColumn>
                                                    <GridColumn Field=@nameof(Contatto.Cellulare) HeaderText="Cellulare" Type="ColumnType.String" AutoFit></GridColumn>
                                                    <GridColumn Field=@nameof(Contatto.Email) HeaderText="Email" Type="ColumnType.String" AutoFit></GridColumn>
                                                    <GridColumn Field=@nameof(Contatto.PEC) HeaderText="PEC" Type="ColumnType.String" AutoFit></GridColumn>
                                                </GridColumns>
                                            </SfGrid>
                                        </div>
                                    </div>
                                </ContentTemplate>
                            </TabItem>
                        </TabItems>

This is my Code, the grid is inside a TabItem. If I don't use the GridForeignComuns all other columns fits properly to the content when I click on the Tab Label.

Image_2013_1780658398719

If the Foreign column is there all other comuns are fitted to the HeaderText instead to the content of cells.

Image_7059_1780658345537



7 Replies

NP Naveen Palanivel Syncfusion Team June 11, 2026 02:53 PM UTC

Hi Michele,

Greetings from Syncfusion,


We have confirmed that this is an issue and logged a defect report titled  “Autofit Does Not Work Correctly When Using GridForeignColumn” This fix will be included in our weekly patch release, which is expected to be rolled out on June 30th  , 2026. You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link.    


https://www.syncfusion.com/feedback/74490/autofit-does-not-work-correctly-when-using-gridforeigncolumn

Disclaimer: “Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization”


We will get back to you once the release is rolled out. Until then we appreciate your patience.


Regards,

Naveen



PS Prathap Senthil Syncfusion Team July 3, 2026 12:33 PM UTC

Due to the upcoming Volume 2, 2026 release, there will be no weekly patch release this week. However, the fix will be included in the first weekly patch release following the Volume 2, 2026 release without further delay. Once the release is deployed, we will provide you with an update. Until then, we sincerely appreciate your patience and understanding.



PS Prathap Senthil Syncfusion Team July 9, 2026 10:27 AM UTC


Thanks for the patience,


We are glad to announce that, we have included the fix for the “Autofit Does Not Work Correctly When Using GridForeignColumn” in our “34.1.30
release.  So please upgrade to our latest version of Syncfusion NuGet package to resolve the reported issue. Please find the NuGet package for latest fixes and features from below.


NuGet: https://www.nuget.org/packages/Syncfusion.Blazor.Grid

Sample: https://blazorplayground.syncfusion.com/embed/rZBRjGXEKzFMXRkc?appbar=true&editor=true&result=true&errorlist=true&theme=fluent2

Root Cause:

The issue occurs because the AutoFit calculation is triggered before the Grid has fully completed its data processing and rendering cycle. In scenarios that include aggregate rows or foreign key columns, the data is processed at a later stage by design. As a result, when AutoFit initially calculates column widths, only the header content is fully available, while the row data is not yet rendered. Because of this timing difference, the column width is calculated primarily based on the header content, which can lead to incorrect AutoFit results.

Solution Description

To address this behavior, the AutoFit operation has been postponed until after the Grid has completed its data processing and rendering activities. The column width calculation is now performed only when all required data and UI elements are fully available. With this change, AutoFit can accurately measure both header and row content before determining column widths, ensuring correct and consistent column sizing in scenarios involving aggregate rows and foreign key columns.



MI Michele July 9, 2026 01:04 PM UTC

I use Syncfusion.Blazor package in my project and it still locked at version 33.2.6

When do you think it will bu updated with the new features?

Image_2950_1783602282677



PS Prathap Senthil Syncfusion Team July 10, 2026 07:37 AM UTC

Thanks for your update.


The fix for this issue is available starting from Syncfusion.Blazor v34.1.30. However, since your project is currently locked to v33.2.6, the fix will not be available in your current version. At the moment, we do not have plans to backport this fix to the 33.2.x release line. To take advantage of this improvement and other latest features, we recommend upgrading to the latest available NuGet package version.

Additionally, we would like to clarify that, starting with the Volume 2 2026 release, the Syncfusion.Blazor overall NuGet package has been unlisted from NuGet.org and will no longer receive updates or new releases.

Users should migrate from the Syncfusion.Blazor package to the required component-specific Syncfusion Blazor NuGet packages (for example, Syncfusion.Blazor.Grid, Syncfusion.Blazor.Charts, Syncfusion.Blazor.Schedule, etc.).

We have already documented this as a breaking change in the release notes. Kindly refer to the notes below for more information.

Release notes: https://blazor.syncfusion.com/documentation/release-notes/34.1.29?type=all#common



MI Michele July 10, 2026 09:28 AM UTC

Version 33.2.6 is the latest available version for Syncfusion.Blazor library in NuGet at the moment.

This can be related to the breaking change you are speaking about, which will create me some problems because I need to understand which packages I need to attach to my projects instead of a single package I used until now!

I'll try to substitute it starting from this project to see if the new realease solve my problems.


Thanks for your assistance

Michele



PS Prathap Senthil Syncfusion Team July 13, 2026 12:00 PM UTC

Thank you for your update.

We understand that migrating from the Syncfusion.Blazor package to component-specific NuGet packages may require some additional effort. To help simplify this process, please refer to the following documentation:

NuGet Packages List for Blazor Components – Provides details about all available component-specific packages and their dependencies:

Based on the code snippet you previously shared, your application uses the DataGrid (SfGrid) and Tab components. Therefore, after migration, you will need at least the following packages:

  • Syncfusion.Blazor.Grid
  • Syncfusion.Blazor.Navigations

You may also find the following getting started guides helpful:

Getting Started with Blazor DataGrid in Web App | Syncfusion®
Getting Started with Blazor Tabs in Blazor Web App | Syncfusion


Depending on the other Syncfusion controls used throughout your application, additional component-specific packages may also be required.


Please proceed with the migration in your test project and let us know if you encounter any issues. We will be glad to help identify the required packages and assist with any migration-related challenges. Thank you for your patience and cooperation.


Loader.
Up arrow icon