Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standard Pagination for Tables #459

Merged
merged 5 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/custom/ResponsiveDataTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export interface ResponsiveDataTableProps {
columnVisibility: Record<string, boolean> | undefined;
theme?: object;
colViews?: Record<string, boolean> | undefined;
rowsPerPageOptions?: number[] | undefined;
}

const ResponsiveDataTable = ({
Expand All @@ -32,6 +33,7 @@ const ResponsiveDataTable = ({
tableCols,
updateCols,
columnVisibility,
rowsPerPageOptions = [20, 50, 100], // Default and standard page size options
...props
}: ResponsiveDataTableProps): JSX.Element => {
const formatDate = (date: Date): string => {
Expand All @@ -47,6 +49,7 @@ const ResponsiveDataTable = ({

const updatedOptions = {
...options,
rowsPerPageOptions: rowsPerPageOptions,
onViewColumnsChange: (column: string, action: string) => {
switch (action) {
case 'add': {
Expand Down
7 changes: 7 additions & 0 deletions src/custom/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ This custom React component, `ResponsiveDataTable`, is a wrapper around the Mate
| `theme` | `object` | (Optional) Theme object for styling the table. |
| `colViews` | `Record<string, boolean> \| undefined` | (Optional) Object representing the visibility status of each column. This is similar to `columnVisibility`. |

### Standard Props

| Property | Type | Description |
| -------- | -------- | ----------------------------------------------------------------------------------------------------------- |
| `rowsPerPageOptions` | `number[]` | (Optional) Array of numbers representing the number of rows per page. If not provided, the default values will be used(20, 50, 100). |


### Customization

### Column Visibility
Expand Down
Loading