PivotDataGrid sorting issue #1946

Closed
opened 2026-01-29 18:15:57 +00:00 by claunia · 4 comments
Owner

Originally created by @TooOldForGitHup on GitHub (Jan 9, 2026).

Describe the bug
The sorting in pivot Grids does not always work as expected

To Reproduce
Using https://blazor.radzen.com/playground/9010a01d-8382-47b9-8c9b-2a30b49d0578

Steps to reproduce the behavior:

  1. Run the snippet
  2. Open the pivot grid Settings
  3. OK so far: Rows are sorted as specified (Descending), Columns using the default.
  4. Change Column C1 ordering to "Descending" by clicking on the "C1" sort icon twice. The Row ordering changes to be (in this example) affectively ascending. More complex data and using the "second level" (e.g. R2 in this example) can produce other unexpected ordering.

In addition, if SortOrder="SortOrder.Descending" is added to the definition of C1, C1 sorting cannot be changed any more using the sort icon.

Both aspects seem to be independent of whether or not Sortable="true" is used.

Expected behavior

  • Row sorting should be as specified, and not change when the column sort order is changed
  • Column sorting should work even with SortOrder="SortOrder.Descending" in the column definition, at least of "sortable=True" is present.

Screenshots
sorry, "Failed to upload"

Desktop (please complete the following information):

  • Kubuntu 25.10
  • Firefox140.4.0esr
Originally created by @TooOldForGitHup on GitHub (Jan 9, 2026). <!-- IMPORTANT: Read this first!!! 1. If you own a Radzen Blazor Pro or Team subscription you can also report your issue or ask us a question via email at info@radzen.com. Radzen staff will reply within 24 hours (Pro) or 16 hours (Team) 2. The Radzen staff guarantees a response to issues in this repo only to paid subscribers. 3. If you have a HOW TO question start a new forum thread in the Radzen Community forum: https://forum.radzen.com. Radzen staff will close issues that are HOWTO questions. 4. Please adhere to the issue template. Specify all the steps required to reproduce the issue. --> **Describe the bug** The sorting in pivot Grids does not always work as expected **To Reproduce** Using [https://blazor.radzen.com/playground/9010a01d-8382-47b9-8c9b-2a30b49d0578](https://blazor.radzen.com/playground/9010a01d-8382-47b9-8c9b-2a30b49d0578) Steps to reproduce the behavior: 1. Run the snippet 2. Open the pivot grid Settings 3. OK so far: Rows are sorted as specified (Descending), Columns using the default. 4. Change Column C1 ordering to "Descending" by clicking on the "C1" sort icon twice. The Row ordering changes to be (in this example) affectively ascending. More complex data and using the "second level" (e.g. R2 in this example) can produce other unexpected ordering. In addition, if ` SortOrder="SortOrder.Descending"` is added to the definition of C1, C1 sorting cannot be changed any more using the sort icon. Both aspects seem to be independent of whether or not `Sortable="true"` is used. **Expected behavior** - Row sorting should be as specified, and not change when the column sort order is changed - Column sorting should work even with ` SortOrder="SortOrder.Descending"` in the column definition, at least of "sortable=True" is present. **Screenshots** sorry, "Failed to upload" **Desktop (please complete the following information):** - Kubuntu 25.10 - Firefox140.4.0esr
Author
Owner

@TooOldForGitHup commented on GitHub (Jan 9, 2026):

New attempt to upload screen shots

OK before changing sort order:
Image

Row sorting wrong after changing C1 sort order:
Image

@TooOldForGitHup commented on GitHub (Jan 9, 2026): New attempt to upload screen shots OK before changing sort order: <img width="794" height="383" alt="Image" src="https://github.com/user-attachments/assets/b21a1436-06ff-4335-96ca-fc6ed4ea41ae" /> Row sorting wrong after changing C1 sort order: <img width="794" height="383" alt="Image" src="https://github.com/user-attachments/assets/b1957a34-48f6-4a93-8b59-a6e2283260c4" />
Author
Owner

@enchev commented on GitHub (Jan 9, 2026):

Sorting and filtering are applied to the source data before pivoted - what you see rendered in the cells are pivoted data. If you believe the sorting should be applied in different way feel free to propose update with a pull request.

@enchev commented on GitHub (Jan 9, 2026): Sorting and filtering are applied to the source data before pivoted - what you see rendered in the cells are pivoted data. If you believe the sorting should be applied in different way feel free to propose update with a pull request.
Author
Owner

@TooOldForGitHup commented on GitHub (Jan 9, 2026):

I'll give it a try, but don't hold your breath. Lack of familiarity with the implementation, and blazor debugging, is one issue. Paging may turn out to be another.

@TooOldForGitHup commented on GitHub (Jan 9, 2026): I'll give it a try, but don't hold your breath. Lack of familiarity with the implementation, and blazor debugging, is one issue. Paging may turn out to be another.
Author
Owner

@TooOldForGitHup commented on GitHub (Jan 13, 2026):

I think the original issue should be solved by this change, at least for pivot grids w/o paging.

PivotRowSorting.patch

The

"In addition, if SortOrder="SortOrder.Descending" is added to the definition of C1, C1 sorting cannot be changed any more using the sort icon.

is in fact independent of the above. At this time, I'm not sure what Radzen's expectation of the sort icon behavior is.
What happens at a technical level is that the row's/column's internal_sort_order is null, and its SortOrder is descending.
The handler (HandleFieldSort) computes "null" as the nextSortOrder (effectively starting from SortOrder=Descending),
and setting that via SetSortOrderInternal ends up being a no-op.

@TooOldForGitHup commented on GitHub (Jan 13, 2026): I think the original issue should be solved by this change, at least for pivot grids w/o paging. [PivotRowSorting.patch](https://github.com/user-attachments/files/24597589/PivotRowSorting.patch) The > "In addition, if SortOrder="SortOrder.Descending" is added to the definition of C1, C1 sorting cannot be changed any more using the sort icon. is in fact independent of the above. At this time, I'm not sure what Radzen's expectation of the sort icon behavior is. What happens at a technical level is that the row's/column's `internal_sort_order` is null, and its `SortOrder` is descending. The handler (`HandleFieldSort`) computes "null" as the `nextSortOrder` (effectively starting from SortOrder=Descending), and setting that via `SetSortOrderInternal` ends up being a no-op.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/radzen-blazor#1946