MCPcopy Index your code
hub / github.com/plotly/dash / makePaginator

Function makePaginator

components/dash-table/src/dash-table/derived/paginator.ts:29–102  ·  view source on GitHub ↗
(params: IPaginatorParams | null)

Source from the content-addressed store, hash-verified

27}
28
29function makePaginator(params: IPaginatorParams | null): IPaginator {
30 if (params === null) {
31 return {
32 loadNext() {},
33 loadPrevious() {},
34 loadFirst() {},
35 loadLast() {},
36 loadPage() {},
37 hasPrevious() {
38 return true;
39 },
40 hasNext() {
41 return true;
42 },
43 isLast() {
44 return false;
45 },
46 lastPage: undefined
47 };
48 }
49
50 const {setProps, page_count} = params;
51 let {page_current} = params;
52
53 if (page_count && page_count - 1 < page_current) {
54 page_current = 0;
55 updatePage();
56 }
57
58 function updatePage() {
59 setProps({
60 page_current,
61 ...clearSelection
62 });
63 }
64
65 function loadPage(page: number) {
66 page = Math.max(0, page);
67 page = page_count ? Math.min(page_count - 1, page) : page;
68
69 page_current = page;
70 updatePage();
71 }
72
73 return {
74 loadNext: () => loadPage(page_current + 1),
75
76 loadPrevious: () => loadPage(page_current - 1),
77
78 loadFirst: () => loadPage(0),
79
80 loadPage,
81
82 loadLast: () => {
83 if (page_count) {
84 loadPage(page_count - 1);
85 }
86 },

Callers 1

getterFunction · 0.85

Calls 2

updatePageFunction · 0.85
loadPageFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…