Skip to content

Commit

Permalink
Merge pull request #9324 from GilbertCherrie/fix_table_pagination_set…
Browse files Browse the repository at this point in the history
…ting

Fix table pagination setting

(cherry picked from commit f94b162)
  • Loading branch information
Fryguy committed Jan 16, 2025
1 parent 576e0f2 commit f94e33c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions app/javascript/components/gtl-view.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ const setPaging = (settings, start, perPage) => ({
const computePagination = (settings) => ({
page: settings.current,
perPage: settings.perpage,
perPageOptions: [10, 20, 50, 100, 200, 500, 1000],
perPageOptions: [5, 10, 20, 50, 100, 200, 500, 1000],
});

const GtlView = ({
Expand All @@ -292,6 +292,9 @@ const GtlView = ({
noFlashDiv,
}) => {
// const { settings, data } = props;
if (pages && pages.perpage) {
initialState.settings.perpage = pages.perpage;
}
const initState = {
...initialState,
additionalOptions,
Expand Down Expand Up @@ -387,7 +390,7 @@ const GtlView = ({
isExplorer,
setPaging(settings, 0, perPage),
records,
additionalOptions,
additionalOptions
);

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

Expand Down

0 comments on commit f94e33c

Please sign in to comment.