diff --git a/app/client/cypress/e2e/Regression/ClientSide/Binding/TableV2_Widget_API_Pagination_spec.js b/app/client/cypress/e2e/Regression/ClientSide/Binding/TableV2_Widget_API_Pagination_spec.js index 8892bd9a4b..6cc8330afd 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Binding/TableV2_Widget_API_Pagination_spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/Binding/TableV2_Widget_API_Pagination_spec.js @@ -4,6 +4,7 @@ import { entityExplorer, propPane, apiPage, + table, } from "../../../../support/Objects/ObjectsCore"; describe("Test Create Api and Bind to Table widget V2", function () { @@ -34,4 +35,18 @@ describe("Test Create Api and Bind to Table widget V2", function () { .first() .should("contain", "2"); }); + + it("2. Bug #22477: should check whether the next page button is disabled and not clickable when last page is reached", () => { + /** + * Flow: + * Update total records count to 20 + * Click next page + */ + + propPane.UpdatePropertyFieldValue("Total Records", "20"); + agHelper.GetNClick(table._nextPage("v2")); + + agHelper.AssertAttribute(table._nextPage("v2"), "disabled", "disabled"); + agHelper.AssertElementAbsence(commonlocators._toastMsg); + }); }); diff --git a/app/client/src/widgets/TableWidgetV2/component/header/actions/index.tsx b/app/client/src/widgets/TableWidgetV2/component/header/actions/index.tsx index a68eda52cd..98233cae13 100644 --- a/app/client/src/widgets/TableWidgetV2/component/header/actions/index.tsx +++ b/app/client/src/widgets/TableWidgetV2/component/header/actions/index.tsx @@ -237,7 +237,13 @@ function Actions(props: ActionsPropsType) { props.pageNo === props.pageCount - 1 } onClick={() => { - props.nextPageClick(); + if ( + !( + !!props.totalRecordsCount && + props.pageNo === props.pageCount - 1 + ) + ) + props.nextPageClick(); }} >