mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-05-10 15:12:12 +00:00
Fix sort order after column reorder on page reload
When columns are reordered via colReorder and the page is reloaded, the saved sort state uses visual column indices. These were sent directly as initial_order to the server, which interprets them as original indices — causing the wrong column to be sorted. Use the saved colReorder mapping to translate visual indices back to original indices before sending initial_order in the _init request.
This commit is contained in:
parent
a82d515034
commit
31e3049bdd
1 changed files with 9 additions and 1 deletions
|
|
@ -113,8 +113,16 @@ export default class extends Controller {
|
|||
return null;
|
||||
}
|
||||
|
||||
//The saved order index is visual (post-reorder). If colReorder state
|
||||
//exists, map it back to the original column index so the server sorts
|
||||
//the correct column. colReorder[visualIndex] == originalIndex.
|
||||
let columnIndex = order[0];
|
||||
if (saved_state.colReorder) {
|
||||
columnIndex = saved_state.colReorder[columnIndex];
|
||||
}
|
||||
|
||||
return {
|
||||
column: order[0],
|
||||
column: columnIndex,
|
||||
dir: order[1]
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue