PivotView Selects Wrong Column
When I select a column in the pivot view, it returns the values for the next column.
<SfPivotView @ref="sfPivotView" TValue="FundAllocation">
<PivotViewDataSourceSettings DataSource="@Allocations">
<PivotViewColumns>
<PivotViewColumn Name="FundCodeAndTitle" />
</PivotViewColumns>
<PivotViewRows>
<PivotViewRow Name="Office" ExpandAll=true />
<PivotViewRow Name="UserName" />
</PivotViewRows>
<PivotViewValues>
<PivotViewValue Name="Perc" />
</PivotViewValues>
<PivotViewFormatSettings>
<PivotViewFormatSetting Name="Perc" Format="N2" />
</PivotViewFormatSettings>
</PivotViewDataSourceSettings>
<PivotViewGridSettings AllowSelection=true AllowTextWrap="false" ColumnWidth="110" ClipMode="PivotTableClipMode.EllipsisWithTooltip">
<PivotViewSelectionSettings Mode="Syncfusion.Blazor.PivotView.SelectionMode.Both" Type="PivotTableSelectionType.Single" CellSelectionMode="PivotCellSelectionMode.Box" />
</PivotViewGridSettings>
<PivotViewEvents TValue="FundAllocation" CellSelected="OnCellSelected" CellClick="OnCellDeselected" />
</SfPivotView>
void OnCellSelected(PivotCellSelectedEventArgs args)
{
var selected = args.SelectedCellsInfo.First().Value;
Console.WriteLine($"selected: {selected}");
}
Hi Patrick,
Thank you for contacting Syncfusion support!
Sorry for the inconvenience. We were able to reproduce the reported issue and we have confirmed this as a bug “Incorrect Column Header Data in Pivot Table's "CellSelected" Event”. The fix for this issue will be included in our upcoming August third weekly release. You can track the status of the issue using the feedback link provided below.
Feedback link – https://www.syncfusion.com/feedback/69354/incorrect-column-header-data-in-pivot-tables-cellselected-event
Disclaimer: “Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works re prioritization”.
In the meantime, we have prepared and attached a sample below to help you overcome this issue. This workaround utilizes the CellSelecting and CellSelected events to achieve the desired behavior.
Code snippet:
|
public void OnCellSelected(PivotCellSelectedEventArgs args) { if (args.SelectedCellsInfo.Count() == 0 || args.SelectedCellsInfo[0].RowHeaders == "") { List<AxisSet> SelectedColumns = new List<AxisSet>(); for (var i = 0; i < args.PivotValues.Count(); i++) { for (int j = 0; j < args.PivotValues[i].Count(); j++) { if (args.PivotValues[i][j] != null && args.PivotValues[i][j].ColIndex == selectedColIndex) { SelectedColumns.Add(args.PivotValues[i][j]); } } } var selected = SelectedColumns.First().FormattedText; Console.WriteLine($"selected: {selected}"); } else { // For row headers var selected = args.SelectedCellsInfo.First().Value; Console.WriteLine($"selected: {selected}"); } }
public void OnCellSelecting(PivotCellSelectedEventArgs args) { if (args.Data != null) { // For column headers selectedColIndex = args.Data.ColIndex; } } |
Output GIF:
Let us know if you need any help with this!
Regards,
Yashvanth G G
Attachment: Blazor_713ad9ad.zip
Hi Patrick,
Thank you for your patience. We’re glad to announce that our weekly release, v30.2.6, has been rolled out. This release includes the fix for the reported issue. Additionally, we’ve prepared and attached a sample using the latest version for your reference.
Output GIF:
Issue Root
Cause:
We resolved an issue in the Pivot Table where the cellSelected event
was returning incorrect cell information. This was caused by a recent
structural update that led to an improper index being assigned to the aria-colindex attribute.
The index assignment has now been corrected to ensure accurate cell information
is returned.
We sincerely thank you for your support and appreciate your patience in waiting for this release. Please feel free to reach out if you require any further assistance.
Regards,
Yashvanth G G
Attachment: Blazor_selection_f85d516e.zip
- 2 Replies
- 2 Participants
-
PK Patrick Kelley
- Aug 5, 2025 10:28 AM UTC
- Aug 20, 2025 07:09 AM UTC