gridjs icon indicating copy to clipboard operation
gridjs copied to clipboard

Sort direction changing on forceRender

Open Zambelli24 opened this issue 1 year ago • 2 comments

Describe the bug For a server side data table, calling forceRender causes the applied sort direction to always be set to ascending for the selected column. When the sort is already ascending this is fine for the user. When the sort is descending, its unexpectedly flipped. This affects only version 6.2.0. I tested against 6.1.0 as well and the issue is not present.

To Reproduce Steps to reproduce the behavior:

  1. Create a table with server-side data, pagination, sort, and search configured
  2. Add a way to update the grid using forceRender. In my use case, there is an external filter that adds a new parameter the API calls being made. This could be as simple as a button that just calls forceRender
  3. Run the table and set the sort on any column to be descending
  4. Execute the method to call forceRender
  5. Notice that the sort direction stays on the correct column but flips from ascending to descending

Expected behavior The sort direction should stay the same whenever forceRender is called regardless of what it was.

Screenshots N/A

Desktop (please complete the following information):

  • OS: macOS Sonoma 14.4
  • Browser: Chrome
  • Version: 130.0.6723.92 (Official Build) (arm64)

Additional context This only seems to happen for server-side grids. Client side data sorts are not affected. I followed the sort config defined on the GridJs docs and found that the value for columns inherently has the wrong direction coming back on it when this bug occurs.

Zambelli24 avatar Dec 30 '24 19:12 Zambelli24

Same here, i'm trying to debug. I'm using server-side data with POST request, the sort direction is forced to ascending at every forceRender

EDIT: I can't debug (i have no time), i just downgraded to 6.1.1 and it works

kionez avatar Feb 14 '25 08:02 kionez

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 26 '25 02:04 stale[bot]