We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents df24682 + 70ef0d7 commit dd8985eCopy full SHA for dd8985e
src/view/plugin/sort/sort.tsx
@@ -15,6 +15,8 @@ import { useStore } from '../../../hooks/useStore';
15
// column specific config
16
export interface SortConfig {
17
compare?: Comparator<TCell>;
18
+ // 1 ascending, -1 descending
19
+ direction?: 1 | -1;
20
}
21
22
// generic sort config:
@@ -96,6 +98,11 @@ export function Sort(
96
98
if (!currentColumn) {
97
99
setDirection(0);
100
} else {
101
+ // if the direction is not set, initialize the selected
102
+ // column direction with the passed prop (default to ascending)
103
+ if (direction === 0) {
104
+ currentColumn.direction = props.direction ?? 1;
105
+ }
106
setDirection(currentColumn.direction);
107
108
}, [state]);
0 commit comments