select number records returned

This commit is contained in:
2022-02-01 11:36:14 +00:00
parent a17385d037
commit c932f57bf3
16 changed files with 212 additions and 53 deletions
+6 -3
View File
@@ -4,6 +4,7 @@ import useTranslation from "next-translate/useTranslation";
const PaginationControl = (props) => {
const {
showNoOfRecords,
orderBy,
fieldSort,
searchString,
@@ -17,7 +18,9 @@ const PaginationControl = (props) => {
const router = useRouter();
const { locale } = router;
const pagesCount = Math.ceil(searchResultsObj["@odata.count"] / 10);
const pagesCount = Math.ceil(
searchResultsObj["@odata.count"] / showNoOfRecords
);
const getRange = (start, end) => {
//console.log(start, end);
@@ -29,9 +32,9 @@ const PaginationControl = (props) => {
const paginationNumbers = (currentPage, pageCount) => {
//console.log(currentPage);
let delta;
if (pageCount <= 10) {
if (pageCount <= showNoOfRecords) {
// delta === 7: [1 2 3 4 5 6 7]
delta = 10;
delta = showNoOfRecords;
} else {
// delta === 2: [1 ... 4 5 6 ... 10]
// delta === 4: [1 2 3 4 5 ... 10]