[英]How to implement a server side pagination with Material ui and react?
對於分頁,您需要:
從客戶端發送到服務器: number of records on page
數和page number
)
從服務器發送到客戶端: from
, to
之間的records
const count = 20; // for example we have 20 records const size = 7; // there are 7 records on each page // number of pages const countPages = Math.ceil (20/7); //show records on page 2: const page = 2; // display 2nd page const from = (page - 1) * size; const to = Math.min (from + size- 1, count); console.log(`we have ${count} records, ${size} per page` ) console.log('number of pages', countPages); console.log(`on page ${page} records from ${from} to ${to}`);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.