Skip to content

Commit

Permalink
switch to first page before filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
drewdaemon committed Aug 19, 2022
1 parent 2ad2211 commit b9b62b2
Showing 1 changed file with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,19 @@ export const DatatableComponent = (props: DatatableRenderProps) => {
[dispatchEvent]
);

const handleFilterClick = useMemo(
() => (isInteractive ? createGridFilterHandler(firstTableRef, onClickValue) : undefined),
[firstTableRef, onClickValue, isInteractive]
);
const handleFilterClick = useMemo(() => {
const handler = isInteractive
? createGridFilterHandler(firstTableRef, onClickValue)
: undefined;
if (handler) {
const wrappedHandler: typeof handler = (...args) => {
// update pagination
onChangePage(0);
return handler(...args);
};
return wrappedHandler;
}
}, [firstTableRef, onClickValue, isInteractive, onChangePage]);

const handleTransposedColumnClick = useMemo(
() =>
Expand Down

0 comments on commit b9b62b2

Please sign in to comment.