Skip to content

Commit

Permalink
fix: respect sort index in sort fields in infinite table (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
mguellsegarra authored Nov 5, 2024
1 parent db02e97 commit 1405af9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/InfiniteTable/InfiniteTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,10 @@ const InfiniteTableComp = forwardRef<InfiniteTableRef, InfiniteTableProps>(
| undefined => {
const state = gridRef?.current?.api.getColumnState()!;

const columnsWithSort = state.filter((col) => col.sort);
const columnsWithSort = state
.filter((col) => col.sort)
.sort((a, b) => (a.sortIndex || 0) - (b.sortIndex || 0));

if (columnsWithSort.length === 0) {
return undefined;
}
Expand Down

0 comments on commit 1405af9

Please sign in to comment.