Syncfusion.Blazor 25.1.39
SfGrid, trying to get a group caption showing the sum of a column.
...
<GridAggregates>
<GridAggregate>
<GridAggregateColumns>
<GridAggregateColumn Field="Quantity1" Type="Syncfusion.Blazor.Grids.AggregateType.Sum">
<GroupCaptionTemplate Context="aggregateContext">
@{
var aggregate = (aggregateContext as AggregateTemplateContext);
<div>
<p>Total Stock : @aggregate.Sum</p>
</div>
}
</GroupCaptionTemplate>
</GridAggregateColumn>
</GridAggregateColumns>
</GridAggregate>
</GridAggregates>
...
Two problems found :
Hi Paul,
We are unable to reproduce the reported issue “GroupCaptionTemplate does
not show my text” when attempting to reproduce the issue in the version 26.1.39
. For your reference we have attached screen shot and simple sample .So, to
further
proceed with the reporting problem, we require some additional clarification
from your end. Please share the below details to proceed further at our end.
|
|
Above-requested details will be very helpful in validating the reported query at our end and providing a solution as early as possible. Thanks for your understanding.
Sample:
https://blazorplayground.syncfusion.com/embed/BNVpjmXbAacGEQRe?appbar=true&editor=true&result=true&errorlist=true&theme=bootstrap5
Regarding the 'DisablePagewiseAggregate' feature, we would like to clarify that
currently we don’t have support for this feature. Thanks for your
understanding.
Regards,
Prathap Senthil
I have found the cause of the first problem - the aggregate is not shown if it is the left-most column being aggregated!
Presumably the standard group caption text overrides this.
Apart from simply moving the column position, is there a way I could make the aggregate text appear above the left-most column?
As for the second problem, if you really are not supporting a correct group aggregate over the entire data set then that is ... disappointing.
This makes it useless for anything except very small sets of data.
Instead, I will have to perform a lookup on a summary hashset based on the group key, or something similar.
Is solving this problem on Syncfusion's roadmap?
Thanks
Paul
We have confirmed this a breaking issue and logged the defect report “Aggregate not shown in group caption row when left-most column is aggregated.” for the same and this fix will be included in our upcoming patch release.
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.
Aggregate not shown in group caption
row when left-most column is aggregated in Blazor | Feedback Portal
(syncfusion.com)
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
Regarding the DisablePageWiseAggregates with EnableLazyLoading, we would like
to clarify that when EnableLazyLoading is enabled, the grouped header will be
loaded with the initial set of records and rendered during the initial
rendering itself. However, the actual records will load only upon expanding the
groups. This behavior is default and hence, it is not feasible to achieve your
requirement of aggregating only the current row records
We regret that we were unable to include this fix in yesterday's patch release. While addressing the issue, we encountered some complexities and need to ensure the solution was thoroughly tested with various test cases. However, we want to assure you that the fix will be included in our next weekly patch release, scheduled for on or before August 27th, 2024. We appreciate your patience and understanding during this time. Thank you
Thanks
for your patience.
We are glad to announce that, we have included the fix for the “Aggregate
not shown in group caption row when left-most column is aggregated.” in
our 26.2.11 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
RootCause: Aggregate value not rendered along with group caption.
.
Corrective
Actions Taken:
Created an object for aggregate value to get aggregate in Caption Template
Context.
Please Note: We have fixed both the sample and the source code. The
problem occurred because the aggregate value was not displayed in the leftmost
grouped column due to our previous implementation's inability to render the
aggregate value within the group caption. This issue has now been resolved by
integrating the caption template context into the group caption via the
aggregate template context property in the source code. Please refer to the
modified code snippet and sample provided below for further reference.
|
<GridGroupSettings Columns=@GroupOptions ShowGroupedColumn="false"> <CaptionTemplate> @{ var captionData = (context as Syncfusion.Blazor.Grids.CaptionTemplateContext); var val2 = captionData.GroupAggregates as AggregateTemplateContext; var collection = new Dictionary<string, object> { ["sum"] = val2.Sum, ["average"] = val2.Average, ["count"] = val2.Count, ["custom"] = val2.Custom, ["truecount"] = val2.TrueCount, ["falseCount"] = val2.FalseCount, ["max"] = val2.Max, ["min"] = val2.Min };
var groupKey = captionData.Key; var FieldName = captionData.Field; var itemCount = captionData.Count; var groupCaption = $"{captionData.Field}: {groupKey} - {itemCount} items"; if (val2.Field != null) { if (val2.Count != null) { <div>@groupCaption Counting: @collection["count"]</div> } else if (val2.Min != null) { <div>@groupCaption Minimum: @collection["min"]</div> } else if (val2.Max != null) { <div>@groupCaption Maximum: @collection["max"]</div> } else if (val2.TrueCount != null) { <div>@groupCaption TrueCounting: @collection["truecount"]</div> } else if (val2.FalseCount != null) { <div>@groupCaption FalseCounting: @collection["falsecount"]</div> } else if (val2.Sum != null) { <div>@groupCaption Sum Value: @collection["sum"]</div> } else if (val2.Average != null) { <div>@groupCaption Average: @collection["average"]</div> } else { <div>@groupCaption Customing: @collection["custom"]</div> } } else { <div> <div>@groupCaption</div> </div> } } </CaptionTemplate> </GridGroupSettings>
|
Sample: Syncfusion
Blazor Playground: Write, Edit, Compile & Share Code for Blazor Components