Hi,
I don't know what has changed recently but Aggregates stopped working with .NET6 & VS2022 for me. I copied the example below from the demos and tested it with .NET5 & VS2019 and .NET6 & VS2022.
@using Syncfusion.Blazor.Grids
<SfGrid DataSource="@Orders" AllowPaging="true">
<GridPageSettings PageSize="8"></GridPageSettings>
<GridAggregates>
<GridAggregate>
<GridAggregateColumns>
<GridAggregateColumn Field=@nameof(Order.Freight) Type="AggregateType.Sum" Format="C2">
<FooterTemplate>
@{
var aggregate = (context as AggregateTemplateContext);
<div>
<p>Sum: @aggregate.Sum</p>
</div>
}
</FooterTemplate>
</GridAggregateColumn>
</GridAggregateColumns>
</GridAggregate>
<GridAggregate>
<GridAggregateColumns>
<GridAggregateColumn Field=@nameof(Order.Freight) Type="AggregateType.Average" Format="C2">
<FooterTemplate>
@{
var aggregate = (context as AggregateTemplateContext);
<div>
<p>Average: @aggregate.Average</p>
</div>
}
</FooterTemplate>
</GridAggregateColumn>
</GridAggregateColumns>
</GridAggregate>
</GridAggregates>
<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{
public List<Order> Orders { get; set; }
protected override void OnInitialized()
{
Orders = Enumerable.Range(1, 75).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; }
}
}
It's working fine with .NET5 but not with .NET6. This is what I see in a .NET6 project.
If I comment out the aggregates, then the grid is displayed with data.
With .NET5, no problem at all.
Is it me doing something wrong?
Hi Adem,
Greetings from Syncfusion support.
Query: “I don't know what has changed recently but Aggregates stopped working with .NET6 & VS2022 for me. I copied the example below from the demos and tested it with .NET5 & VS2019 and .NET6 & VS2022.”
We have checked your query and prepared an sample (.Net6) with the provided code snippet. But we could not able to reproduce the reported issue at our end. Kindly check the attached sample for your reference.
Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/BlazorApp11599941030.zip
Also we would like to inform that we have included breaking changes in loading scripts and styles in our latest version and javascript isolation is marked as obsolete from our version(20.1.0.47). So we suggest you to use any one of the below method to load styles and scripts externally for better performance.
Also refer the below release notes for your additional information.
Reference: https://blazor.syncfusion.com/documentation/release-notes/20.1.47?type=all#common
Example code snippet:
|
[layout.cshtml]/[Host.cshtml]
<link rel='nofollow' href=https://cdn.syncfusion.com/blazor/20.1.60/styles/bootstrap5.css rel="stylesheet"/> <script src=https://cdn.syncfusion.com/blazor/20.1.60/syncfusion-blazor.min.js type="text/javascript"></script>
|
Note: Need to disable javascript isolation while using the above ways( AddSyncfusionBlazor()).
If the reported issue still persist then kindly get back to us with below details to validate further at our end.
The above-requested details will be very helpful for us to validate the reported query at our end and provide the solution as early as possible.
Regards,
Monisha
Hi Monisha,
Thanks for your response. I have also tried your sample but no luck unfortunately. Somehow it's related to Aggregate.Sum and Average because it's working fine if I make it Custom. I have nothing new to reproduce the issue on your side. I gave up anyway.
Hi Adem,
Sorry for the inconvenience caused.
We could not able to reproduce the reported issue at our end. But we are facing similar issue with Grid aggregates on random scenarios. We have considered this as an bug and we will fix this issue internally and it will be included on our Volume 2, 2022 release which is expected to be rolled out on or before end of June. We will update you once the release is rolled out.
Until then we appreciate your patience.
Regards,
Monisha
Hi Adem,
Thanks for the patience.
We are glad to announce that our Essential Studio 2022 Volume 2 release v20.2.0.36 is rolled out and we have included fix related to the issue “Grid does not rendered properly when using Aggregates” in our release. So please upgrade to our latest version of Syncfusion NuGet package to resolve the reported issue and kindly get back to us if you still face any difficulties.
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,
Monisha