massenergize / frontend-admin

Frontend for the Admin Portal. This web interface is used by Community Admins (cadmins) to administer community-specific portals and by Super Admins to administer the entire MassEnergize web platform.
4 stars 3 forks source link

Fix: Sorting data with MUI data Tables #1237

Closed abdullai-t closed 1 month ago

abdullai-t commented 2 months ago

Summary / Highlights

This pull request fixes the bug related to sorting data on the MUI data table. The issue was caused by changes to the key for sort parameters on the tableState object. Additionally, this PR adds functionality to persist the sorting direction even after the page reloads. This PR works with API PR

Details (Give details about what this PR accomplishes, include any screenshots etc.)

Testing Steps (Provide details on how your changes can be tested)

Requirements

Transparency (Project board)

What kind of change does this PR introduce? (check at least one)

Does this PR introduce a breaking change? (check one)

If yes, please describe the impact and migration path for existing applications:

The PR fulfills these requirements:

Other information: Any otherthing we need to know

BradHN1 commented 1 month ago

@abdullai-t This does not meet the requirements of the issue #1135. There are two problems with it.

When sorting by a column header, there should be just two states: ascending and descending. In the dev admin portal, when I sort actions based on Title, the first state that shows up is Descending. It should be Ascending, and the arrow shows it as ascending, but the top entry is later in the alphabet: Screenshot 2024-07-16 at 5 22 16 PM

When I click a second time, the order reverses, as expected. When I click a third time, the arrow disappears and it is still sorted as ascending: Screenshot 2024-07-16 at 5 22 42 PM