Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Practice Data Pagination!
You have completed Practice Data Pagination!
Preview
This video shows one way of dynamically creating and inserting the author cards to the DOM.
Resources
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
All right, for steps four and five, I've
created variables named start and end.
0:00
For start, I've multiplied our page
variable by our authors per page,
0:00
then subtracted authors
per page from that result.
0:04
For end,
I've done the same multiplication.
0:07
But instead, subtracted 1 from the result.
0:10
Because remember, arrays are zero-based.
0:12
Now, we can dynamically add the correct
authors to whichever page we decide to
0:16
display.
0:21
Step six is a sneaky
issue that is necessary.
0:22
Because without it, the browser would
keep displaying all of the author cards
0:24
from previous pages we've viewed.
0:29
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up