Grid EnablePersistence=true does not apply column widths after AutoFitAll function of Context menu

Hello,


I am having a problem with the following grid code. When I resize the columns individually and navigate away from the page and back again, the column widths are reapplied correctly. However, If I use the AutoFitAll function of the context menu and then navigate away and back again, the column widths are not being reapplied.


<SfGrid @ref="DefaultGrid" DataSource="@Orders"

    AllowSorting="true"

    AllowResizing="true"

    ID="TestAutoResize"

    EnablePersistence="true"

    ContextMenuItems="@(new List<object>() { "AutoFit", "AutoFitAll"})"

>

    <GridColumns>

        <GridColumn Field=@nameof(Order.OrderID) HeaderText="Order ID" TextAlign="TextAlign.Right" Width="120"></GridColumn>

        <GridColumn Field=@nameof(Order.CustomerID) HeaderText="Customer Name" Width="150"></GridColumn>

        <GridColumn Field=@nameof(Order.OrderDate) HeaderText=" Order Date" Format="d" Type="ColumnType.Date" TextAlign="TextAlign.Right" Width="130"></GridColumn>

        <GridColumn Field=@nameof(Order.Freight) HeaderText="Freight" Format="C2" TextAlign="TextAlign.Right" Width="120"></GridColumn>

    </GridColumns>

</SfGrid>


@code{

    private SfGrid<Order> DefaultGrid;


    public List<Order> Orders { get; set; }


    protected override void OnInitialized()

    {

        Orders = Enumerable.Range(1, 20).Select(x => new Order()

        {

            OrderID = 1000 + x,

            CustomerID = (new string[] { "ALFKI", "ANANTR", "ANTON", "BLONP", "BOLID" })[new Random().Next(5)],

            Freight = 2.1 * x,

            OrderDate = DateTime.Now.AddDays(-x),

        }).ToList();

    }


    public class Order

    {

        public int? OrderID { get; set; }

        public string CustomerID { get; set; }

        public DateTime? OrderDate { get; set; }

        public double? Freight { get; set; }

    }


I have experienced the same problem when using the GetPersistData and SetPersistData which is what I actually need to do as I want to save the grid state in the database.


Please advise what I need to do to get the column width to be correctly reapplied after using AutoFitAll and navigating away and back acgain.to work.


Thanks,


Chuck



8 Replies

RS Renjith Singh Rajendran Syncfusion Team February 8, 2022 01:52 AM UTC

Hi Chuck, 
 
Greetings from Syncfusion support. 
 
We are checking this scenario from our side. We will update you further details on or before February 10, 2022. 
 
Until then we appreciate your patience. 
 
Regards, 
Renjith R 



RS Renjith Singh Rajendran Syncfusion Team February 10, 2022 01:08 PM UTC

Hi Chuck, 
 
Sorry for the inconvenience caused. 
 
We could reproduce the reported problem from our side. We are currently validating the reported problem from our side with high priority. But due to some complexities we are facing we will update you further details within two business days. 
 
Until then we appreciate your patience. 
 
Regards, 
Renjith R 



RS Renjith Singh Rajendran Syncfusion Team February 14, 2022 10:11 AM UTC

Hi Chuck, 
 
We have confirmed this as an issue and logged the defect report “Problem with persisting AutoFit column width for the same. Thank you for taking time to report this issue and helping us improve our product. At Syncfusion, we are committed to fixing all validated defects (subject to technological feasibility and Product Development Life Cycle) and including the fix in our upcoming bi-weekly release which is expected to be rolled out on or before the mid of March 2022. 
         
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.         

Regards, 
Renjith R 
 



RS Renjith Singh Rajendran Syncfusion Team April 21, 2022 11:08 AM UTC

Hi Chuck,


We are glad to announce that our patch release v20.1.0.48 has been rolled out successfully and in this release, we have included the fix for this issue in our latest nuget. So kindly update your NuGet to our latest version to resolve the reported issue.


Please find the NuGet package below

NuGethttps://www.nuget.org/packages/Syncfusion.Blazor.Grid

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


We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance. 


Regards,

Renjith R 



CR Chuck Richardson May 13, 2022 03:15 PM UTC

Hi Renjith,


This has fixed the problem I was experiencing.


Thanks,


Chuck



RS Renjith Singh Rajendran Syncfusion Team May 16, 2022 05:06 AM UTC

Hi Chuck,


Thanks for your update. We are glad to hear that the reported issue is resolved. Please get back to us if you need further assistance.


Regards,

Renjith R




SE Seth April 5, 2023 09:46 PM UTC

Is it possible that this (re)broke in more recent versions?  I'm using 21.1.37 and experiencing the same issue.



MS Monisha Saravanan Syncfusion Team April 11, 2023 01:10 PM UTC

Hi Seth,


We have fixed similar issue in our latest nuget version (21.1.39). So please upgrade to our latest Nuget version and check the reported issue at your end.


Kindly get back to us if you still face any difficulties.


Regards,

Monisha


Loader.
Up arrow icon