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
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
NuGet: https://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
Hi Renjith,
This has fixed the problem I was experiencing.
Thanks,
Chuck
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
Is it possible that this (re)broke in more recent versions? I'm using 21.1.37 and experiencing the same issue.
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