Skip to content

Commit 35ef592

Browse files
committed
PDS-612 Adding custom rows per page (#589)
* PDS-612 Adding custom rows per page * PDS-612 adding git PR numbr to changelog * PDS-612 Fixing prop description * PDS-612 removing settings file * PDS-612 removing recat components bump * PDS-612 updating package lock * PDS-612 Adding correct default value for rowsPerPageOptions
1 parent 9c3fe9a commit 35ef592

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

packages/data-grid/src/tableFooter/TableFooter.jsx

+16-8
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,16 @@ const propTypes = {
9292
}
9393
return null;
9494
},
95-
/** The number of nearest neighbors of the currently selected page that are shown in the numbres list. */
95+
/** The number of nearest neighbors of the currently selected page that are shown in the numbers list. */
9696
delta: PropTypes.number,
9797
children: PropTypes.node,
98+
/** Optional The options available in the rows per page selector drop down */
99+
rowsPerPageOptions: PropTypes.arrayOf(
100+
PropTypes.shape({
101+
value: PropTypes.number,
102+
label: PropTypes.string,
103+
}),
104+
),
98105
};
99106

100107
const defaultProps = {
@@ -109,13 +116,13 @@ const defaultProps = {
109116
updatePage: () => {},
110117
delta: 1,
111118
children: undefined,
119+
rowsPerPageOptions: [
120+
{ value: 5, label: '5' },
121+
{ value: 10, label: '10' },
122+
{ value: 25, label: '25' },
123+
{ value: 50, label: '50' },
124+
],
112125
};
113-
const rowsPerPageDefaultOptions = [
114-
{ value: 5, label: '5' },
115-
{ value: 10, label: '10' },
116-
{ value: 25, label: '25' },
117-
{ value: 50, label: '50' },
118-
];
119126

120127
function TableFooter({
121128
children,
@@ -129,6 +136,7 @@ function TableFooter({
129136
pageCount,
130137
updatePage,
131138
delta,
139+
rowsPerPageOptions,
132140
}) {
133141
return (
134142
<div className="dg-table-footer-container">
@@ -158,7 +166,7 @@ function TableFooter({
158166
</Text>
159167
<ButtonSelect
160168
className="dg-table-footer-rows-per-page-select"
161-
options={rowsPerPageDefaultOptions}
169+
options={rowsPerPageOptions}
162170
value={rowsPerPageValue}
163171
type="secondary"
164172
onChange={onRowPerPageSelect}

0 commit comments

Comments
 (0)