The SfGrid GridColumn AutoFit property is not working after updating from version 28.2.5 to 28.2.6 or 28.2.7.

Hi,

After updating my SfGrid component from 28.2.5 to 28.2.6 or 28.2.7, the GridColumn headers, which have AutoFit=true, are no longer retaining their width data, causing them to appear distorted.

2025-03-01_06-39-27.jpg


My Code



Welcome to your new app.


<div class="col-lg-12 control-section">
    <div class="content-wrapper">
        <div class="row">
            <SfGrid DataSource="@GridData" AllowPaging="true">
                <GridPageSettings PageCount="5"></GridPageSettings>
                <GridColumns>
                    <GridColumn Field=@nameof(OrdersDetails.OrderID) HeaderText="Order ID" TextAlign="TextAlign.Right" AutoFit=true></GridColumn>
                    <GridColumn Field=@nameof(OrdersDetails.CustomerID) HeaderText="Customer ID" AutoFit=true></GridColumn>
                    <GridColumn Field=@nameof(OrdersDetails.OrderDate) HeaderText=" Order Date" Format="d" Type="ColumnType.Date" TextAlign="TextAlign.Right" AutoFit=true></GridColumn>
                    <GridColumn Field=@nameof(OrdersDetails.Freight) Format="C2" TextAlign="TextAlign.Right" AutoFit=true></GridColumn>
                    <GridColumn Field=@nameof(OrdersDetails.ShippedDate) HeaderText="Shipped Date" Format="d" TextAlign="TextAlign.Right" AutoFit=true></GridColumn>
                    <GridColumn Field=@nameof(OrdersDetails.ShipCity) HeaderText="Ship City" ></GridColumn>
                </GridColumns>
            </SfGrid>
        </div>
    </div>
</div>
@code{
    public List<OrdersDetails> GridData { get; set; }
    protected override void OnInitialized()
    {
        GridData = OrdersDetails.GetAllRecords();
    }
}


The  Attachment is code sample.


Attachment: BlazorApp6_57f53de4.zip


3 Replies

NP Naveen Palanivel Syncfusion Team March 3, 2025 06:32 PM UTC

Hi Thomas Leung,

We have checked your query, and it seems that GridColumn AutoFit property is not working after upgrading to the latest version. However, we tested it on our side, and the issue did not occur. Please refer to the attached video demonstration. Additionally, try clearing the bin, obj, and .vs folders, as well as the NuGet and browser caches, to see if the issue persists.




Regards,
Naveen.


Attachment: BlazorApp6_57f53de4_(2)_ce767088.zip


TL Thomas Leung March 4, 2025 12:15 AM UTC

Hi Naveen Palanivel,


Thank you for your reply. Clearing the browser cache resolved the issue.




NP Naveen Palanivel Syncfusion Team March 5, 2025 01:29 AM UTC

Hi Thomas,


Welcome.

Kindly get back to us if you have further queries. As always we will be assist you.


Regards,
Naveen


Loader.
Up arrow icon