-
ProblemFor example, a GET API response returns a list of data. However, the actual total amount of rows is unknown. Instead, the API response returns a token for the next page, which is subsequently used in a second request to retrieve the next page. In Cloudant, this is known as bookmark-style pagination (see https://cloud.ibm.com/docs/Cloudant?topic=Cloudant-pagination-and-bookmarks). For all intents and purposes, let's call this infinite scroll pagination style. I don't think Carbon supports this style of pagination yet. I think Carbon needs to support this form of pagination because it is a valid API pagination pattern used by teams in the industry. There is already an existing Proposed solutionTo support the above pagination pattern I think this will entail the following extensions to the
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
@alcarasj do you have any visual specs or a code sandbox to show how this works? General impression: Some questions for thought:
|
Beta Was this translation helpful? Give feedback.
-
Thanks for the reply! It appears that the proposed pattern of behaviour is already achievable in latest Carbon. Please see sandbox here: https://codesandbox.io/s/carbon-components-react-forked-ixgbq . Note in the
Yes, this is meant for data tables. The infinite-style scrolling pagination (in the context of Cloudant) is used for index performance.
Both - this concerns the pagination of lazily-loaded content, i.e. in the infinite scroll pattern that is described, the API is only returning a subset of data with no indicator as to how much total elements are left in the entire set of data.
I think if the user selected "show all" then there would not be pagination? The user would just scroll endlessly without changing pages. However for the pattern described here, we are still paginating the data and allowing the user to switch between pages. It's just that we don't know how exactly how much data is left. We only know if there exists a next page or a previous page.
Yes - apparently the pattern described here is already supported. |
Beta Was this translation helpful? Give feedback.
@aagonzales
Thanks for the reply! It appears that the proposed pattern of behaviour is already achievable in latest Carbon. Please see sandbox here: https://codesandbox.io/s/carbon-components-react-forked-ixgbq . Note in the
MOCK_DATA
constant I'm roughly mocking what the UI would receive if the API returns a list of data in the infinite-scroll pattern (existence of previous and next page token). Then I just hid the page number selector dropdown, which is probably the only thing that needs to be changed?Yes, this is meant for data tables. The infinite-style scrolling pagination (in the context of Cloudant) is used for index per…