Build a datatable component based on this package to have default configurations using typescript #496
-
I am trying to build a datatable component to reuse default configurations for my mantine-datatable. However, I have problems building the component using typescript. Here's what I've tried: import {
DataTableProps,
DataTableRowExpansionCollapseProps,
DataTableSortProps,
DataTableSelectionProps,
DataTableEmptyStateProps,
DataTablePaginationProps,
DataTableOuterBorderProps,
DataTableRowExpansionProps,
DataTableDefaultColumnProps,
DataTable as MantineDatatable
} from "mantine-datatable";
export const DataTable = (
props: DataTableProps<T> &
DataTableRowExpansionCollapseProps &
DataTableSortProps &
DataTableSelectionProps &
DataTableEmptyStateProps &
DataTablePaginationProps &
DataTableOuterBorderProps &
DataTableRowExpansionProps &
DataTableDefaultColumnProps
) => {
return (
<MantineDatatable
striped
textSelectionDisabled
withRowBorders={true}
withTableBorder={false}
highlightOnHover
borderRadius="sm"
minHeight={500}
defaultColumnProps={{
titleClassName: "text-xs p-2 font-light",
cellsClassName: "text-xs p-2 break-words"
}}
loaderBackgroundBlur={3}
loadingText="Fetching data"
{...props}
/>
);
}; Above code results in: is not assignable to type |
Beta Was this translation helpful? Give feedback.
Answered by
reintroducing
Jan 23, 2024
Replies: 1 comment 1 reply
-
here is a custom component i built to do practically the same, hopefully it helps you:
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
ceciiiron
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
here is a custom component i built to do practically the same, hopefully it helps you: