Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conditionaly renders pagination component if number of entries is more than results per page #9004

Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/Common/Pagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const Pagination = ({
};

const totalCount = data.totalCount;
if (!totalCount) {
if (!totalCount || totalCount <= rowsPerPage) {
return null;
}
const totalPage = Math.ceil(totalCount / rowsPerPage);
Expand Down
8 changes: 1 addition & 7 deletions src/components/Facility/FacilityStaffList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,7 @@ export const FacilityStaffList = (props: any) => {
},
onResponse: ({ res, data }) => {
if (res?.ok && data) {
let totalCount = 0;
data.results.map((doctor: DoctorModal) => {
if (doctor.count) {
totalCount += doctor.count;
}
});
setTotalDoctors(totalCount);
setTotalDoctors(data.count);
}
},
});
Expand Down
Loading