Pagination
Pagination is enabled by default and shows 12 records per page.
Config
var dashboard = new FutureLabs.Dashboard({
config: {
tabs: {
'User Profiles': {
itemsPerPage: 12, // defaults to 12
page: 1 // the page to open on, 1-based
}
}
}
});Paging from code
page
Current page, 1-based.
pages
Total pages, derived from count and itemsPerPage.
count
Total records. From the server when fetching.
Paging on the server
When a tab fetches, only one page is ever in memory. page and itemsPerPage are sent with every request and the server returns that slice plus a total:
count is what drives the pager β without it DashboardJS cannot know how many pages exist. See Fetch API.
Updating the total without reloading
setCount() updates the total and the pager while leaving the rows on screen alone:
This is what a count-only load uses. Passing such a response through setData() would blank a populated tab, because a count-only response carries an empty list.
Rapid clicks
Only one page change runs at a time. A click arriving mid-flight is queued and runs when the active one finishes, and further clicks replace that queued one rather than stacking β so a burst of clicks settles on the last page you asked for instead of racing.
Last updated