pagination count fix on change page size

This commit is contained in:
2022-02-10 17:06:51 +00:00
parent 4ae5f93e48
commit d59b59c016
8 changed files with 149 additions and 40 deletions
+12 -1
View File
@@ -1,7 +1,6 @@
import Link from "next/link";
import { useRouter } from "next/router";
import useTranslation from "next-translate/useTranslation";
import { setCurrentReference } from "../../store/currentView/action";
import { connect } from "react-redux";
import jsonpath from "jsonpath";
import _ from "lodash";
@@ -20,6 +19,11 @@ import {
setSearchDetails,
} from "../../store/searchOutput/action";
import { getSearchDetailsPaged } from "../utils";
import {
currentViewActionTypes,
setCurrentReference,
setCurrentPage,
} from "../../store/currentView/action";
const DNSSearchResults = (props) => {
const {
@@ -30,6 +34,7 @@ const DNSSearchResults = (props) => {
setSearchResults,
setSearchDetails,
advancedSearch,
setCurrentPage,
} = props;
let { t } = useTranslation();
@@ -367,6 +372,8 @@ const DNSSearchResults = (props) => {
</ul>
</div>
</div>
{searchResultsObj["@odata.count"]}
{searchResultsObj["@odata.count"] > 5 && (
<div id="recordCountSelect" className="govuk-grid-row">
<div className="govuk-form-group">
@@ -375,6 +382,7 @@ const DNSSearchResults = (props) => {
<select
onChange={(e) => {
setSelectedOption(e.target.value);
setCurrentPage(1);
}}
value={selectedOption}
className="govuk-select"
@@ -421,6 +429,9 @@ const mapDispatchToProps = (dispatch) => {
setSearchDetails: (searchDetailsObj) => {
dispatch(setSearchDetails(searchDetailsObj));
},
setCurrentPage: (currentPage) => {
dispatch(setCurrentPage(currentPage));
},
};
};