Skip to content

Commit f94b162

Browse files
authored
Merge pull request #9324 from GilbertCherrie/fix_table_pagination_setting
Fix table pagination setting
2 parents 6462723 + 4a5b3d4 commit f94b162

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

app/javascript/components/gtl-view.jsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ const setPaging = (settings, start, perPage) => ({
273273
const computePagination = (settings) => ({
274274
page: settings.current,
275275
perPage: settings.perpage,
276-
perPageOptions: [10, 20, 50, 100, 200, 500, 1000],
276+
perPageOptions: [5, 10, 20, 50, 100, 200, 500, 1000],
277277
});
278278

279279
const GtlView = ({
@@ -292,6 +292,9 @@ const GtlView = ({
292292
noFlashDiv,
293293
}) => {
294294
// const { settings, data } = props;
295+
if (pages && pages.perpage) {
296+
initialState.settings.perpage = pages.perpage;
297+
}
295298
const initState = {
296299
...initialState,
297300
additionalOptions,
@@ -387,7 +390,7 @@ const GtlView = ({
387390
isExplorer,
388391
setPaging(settings, 0, perPage),
389392
records,
390-
additionalOptions,
393+
additionalOptions
391394
);
392395

393396
/** Function execution when a page or perPage is changed in carbon pagination events. */
@@ -528,7 +531,9 @@ GtlView.propTypes = {
528531
records: PropTypes.arrayOf(PropTypes.any), // fixme
529532
hideSelect: PropTypes.bool,
530533
showUrl: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
531-
pages: PropTypes.shape({}), // fixme
534+
pages: PropTypes.shape({
535+
list: PropTypes.number, reports: PropTypes.number, grid: PropTypes.number, tile: PropTypes.number,
536+
}),
532537
isAscending: PropTypes.bool,
533538
};
534539

0 commit comments

Comments
 (0)