Skip to content

Commit dfee50e

Browse files
authored
Merge pull request #459 from sudhanshutech/standard/pagination
Standard Pagination for Tables
2 parents 2791a5c + 748c874 commit dfee50e

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/custom/ResponsiveDataTable.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export interface ResponsiveDataTableProps {
2323
columnVisibility: Record<string, boolean> | undefined;
2424
theme?: object;
2525
colViews?: Record<string, boolean> | undefined;
26+
rowsPerPageOptions?: number[] | undefined;
2627
}
2728

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

4850
const updatedOptions = {
4951
...options,
52+
rowsPerPageOptions: rowsPerPageOptions,
5053
onViewColumnsChange: (column: string, action: string) => {
5154
switch (action) {
5255
case 'add': {

src/custom/readme.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ This custom React component, `ResponsiveDataTable`, is a wrapper around the Mate
3333
| `theme` | `object` | (Optional) Theme object for styling the table. |
3434
| `colViews` | `Record<string, boolean> \| undefined` | (Optional) Object representing the visibility status of each column. This is similar to `columnVisibility`. |
3535

36+
### Standard Props
37+
38+
| Property | Type | Description |
39+
| -------- | -------- | ----------------------------------------------------------------------------------------------------------- |
40+
| `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). |
41+
42+
3643
### Customization
3744

3845
### Column Visibility

0 commit comments

Comments
 (0)