-
-
Notifications
You must be signed in to change notification settings - Fork 271
-
I need to build a function that automatically changes page every few seconds, does anyone know if there is a hook to call next page on the pagination component, I'm using it within CDataTable.
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment
-
This is what I ended up with not ideal, I tried using the activePage prop which I think would be cleaner but that only changed the pagination number but not the data on the table.
const pagination = useRef()
useEffect(() => {
const nextButton = pagination.current.querySelector('[aria-label="Go to next page"]');
const next = () => setInterval(() => {
nextButton.click()
}, 10000)
next()
}, []);
<CDataTable
items={orderLineList}
fields={fields}
addTableClasses={""}
itemsPerPage={10}
hover
loading={loading}
pagination={{ innerRef: pagination }}
/>
If anyone can come up with a better solution please let me know.
Beta Was this translation helpful? Give feedback.
All reactions
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment