Skip to content

Commit

Permalink
Merge pull request #459 from sudhanshutech/standard/pagination
Browse files Browse the repository at this point in the history
Standard Pagination for Tables
  • Loading branch information
leecalcote authored Feb 5, 2024
2 parents 2791a5c + 748c874 commit dfee50e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
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

0 comments on commit dfee50e

Please sign in to comment.