Skip to content

Commit

Permalink
fix: column right pin ruins menu order
Browse files Browse the repository at this point in the history
column right pin pushes menu item to the bottom instead of keeping correct order
  • Loading branch information
renatoka committed Feb 29, 2024
1 parent e572e0d commit 7af8c28
Showing 1 changed file with 8 additions and 1 deletion.
Expand Up @@ -63,7 +63,14 @@ export const MRT_ShowHideColumnsMenu = <TData extends MRT_RowData>({
getCenterLeafColumns().find((col) => col?.id === colId),
),
...getRightLeafColumns(),
].filter(Boolean);
]
.filter(Boolean)
.sort((a, b) => {
return (
columnOrder.indexOf((a as MRT_Column<TData>).id) -
columnOrder.indexOf((b as MRT_Column<TData>).id)
);
});
}
return columns;
}, [
Expand Down

0 comments on commit 7af8c28

Please sign in to comment.