WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Conversation

@tomjose92
Copy link
Contributor

@tomjose92 tomjose92 commented Nov 26, 2025

Description

Added a setPageNumber function for Table widget to programatically change pages on the table.

This change allows the user to set the pageNo to any number value. What this means is that

  1. For Client side pagination, the user will not be restricted from changing to a page number that is greater than total number of pages.
  2. For Server side pagination, the user will have to programatically call the query to get data after programatically changing page number.

The setPageNumber function will throw error if any value that does not evaluate to a postive integer greater than 0 is passed.

Fixes 24973
Fixes 8440

Automation

/ok-to-test tags="@tag.Table"

🔍 Cypress test results

Warning

Tests have not run on the HEAD d52ab88 yet


Thu, 27 Nov 2025 03:59:59 UTC

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

Summary by CodeRabbit

  • New Features

    • Table widgets expose a programmatic page-number setter to change the current page.
    • Pagination now includes a configurable page-number property with numeric validation and default.
  • Improvements

    • Server-side pagination better handles programmatic vs user-driven page changes and avoids duplicate triggers.
    • Page number display switched to an editable page-number input in the header.
  • Tests

    • Tests updated to exercise and validate the new page-number setter behavior.

✏️ Tip: You can customize this high-level summary in your review settings.

@tomjose92 tomjose92 requested review from a team as code owners November 26, 2025 16:06
@tomjose92 tomjose92 requested review from rahulbarwal and removed request for a team November 26, 2025 16:06
@github-actions github-actions bot added the Enhancement New feature or request label Nov 26, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 26, 2025

Walkthrough

Adds a public setter setPageNumber (number) mapped to pageNo, exposes pageNo in TableWidgetV2 property pane, replaces page number display with an editable input, and augments widget logic to handle programmatic page changes: clamping to max pages, distinguishing programmatic vs user-driven changes, and triggering server-side pagination callbacks (onPageChange) with appropriate event types.

Changes

Cohort / File(s) Summary
TableWidgetV2 — setter & logic
app/client/src/widgets/TableWidgetV2/widget/index.tsx
Added setPageNumber to getSetterConfig().__setters (maps to pageNo: number); added logic to clamp pageNo to max pages, mark navigation direction as NEXT_PAGE when clamped, and detect programmatic calls to trigger updatePageNumber / onPageChange with event types (ON_NEXT_PAGE / ON_PREV_PAGE) while avoiding double-trigger on clamp.
WDSTableWidget — setter config
app/client/src/widgets/wds/WDSTableWidget/config/settersConfig.ts
Added setPageNumber to exported settersConfig.__setters mapping to pageNo: number.
Property pane — pagination
app/client/src/widgets/TableWidgetV2/widget/propertyConfig/contentConfig.ts
Added pageNo property under Pagination (isBindProperty: true, isTriggerProperty: false, validation: NUMBER, min:1, default:1, natural).
Header — UI for page number
app/client/src/widgets/TableWidgetV2/component/header/actions/index.tsx
Replaced PaginationItemWrapper occurrences with PageNumberInput for rendering/editing current page number; wiring uses pageNo + 1, pageCount, disabled, and updatePageNo.
Tests — data tree & evaluation
app/client/src/entities/DataTree/dataTreeWidget.test.ts, app/client/src/workers/Evaluation/__tests__/setters.test.ts
Updated tests/expectations to include setPageNumber setter (paths referencing ...pageNo / Table1.pageNo); added test calling setPageNumber(2) and asserting pageNo update.

Sequence Diagram(s)

sequenceDiagram
  participant Caller as External code
  participant Setter as Widget Setter API
  participant Widget as TableWidgetV2
  participant Runtime as Evaluation / DataTree
  participant Server as onPageChange handler

  Note over Caller,Setter: New public setter exposed
  Caller->>Setter: setPageNumber(targetPage)
  Setter->>Widget: set pageNo = targetPage  %%cyan%%
  alt targetPage > maxPage
    Widget->>Widget: clamp pageNo = maxPage  %%orange%%
    Widget->>Widget: mark navigation = NEXT_PAGE
    Widget-->>Setter: resolved (clamped)
  else not clamped
    Widget->>Runtime: propagate pageNo change / re-evaluate bindings  %%cyan%%
    Runtime-->>Widget: evaluation complete
    alt server-side pagination enabled & onPageChange exists
      Widget->>Server: updatePageNumber(eventType=ON_NEXT_PAGE|ON_PREV_PAGE)  %%green%%
      Server-->>Widget: fetch/ack
    end
    Widget-->>Setter: resolved
  end
Loading

Notes: colored notes indicate (cyan) typical propagation path, (orange) clamp path, (green) server callback.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Pay attention to the new control flow in app/client/src/widgets/TableWidgetV2/widget/index.tsx where:
    • Programmatic vs user-driven origin is detected.
    • Clamping logic prevents double-triggering of server callbacks.
    • Correct eventType selection for onPageChange (ON_NEXT_PAGE / ON_PREV_PAGE).
  • Verify tests in dataTreeWidget.test.ts and setters.test.ts correctly reflect setter exposure and runtime behavior.
  • Confirm PageNumberInput integration preserves accessibility and boundary behaviors (1-based UI vs 0-based internal pageNo).

Poem

✨ A tiny setter takes the stage,
Jumping pages with a measured page,
Clamp if too far, call back when new,
Tests nod yes, UI shows the view.
PageNo set — the table turns true.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding a setPageNumber function for the Table v2 widget, which aligns with the core objective of the PR.
Linked Issues check ✅ Passed The changes implement the core requirement from issue #24973: enabling direct page number setting in Table widget for both client and server-side pagination scenarios.
Out of Scope Changes check ✅ Passed All changes are directly scoped to implementing setPageNumber functionality: setter configuration files, widget component updates, test files, and property configurations align with the stated objective.
Description check ✅ Passed PR description covers the feature purpose, behavior for both client and server-side pagination, error handling, and links to resolved issues.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/issue-24973/table-set-page-no

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@tomjose92
Copy link
Contributor Author

/build-deploy-preview skip-tests=true

@github-actions
Copy link

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/19710098635.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 41421.
recreate: .

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2ff9f01 and 3edb7cc.

📒 Files selected for processing (2)
  • app/client/src/widgets/TableWidgetV2/widget/index.tsx (1 hunks)
  • app/client/src/widgets/wds/WDSTableWidget/config/settersConfig.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: client-build / client-build
  • GitHub Check: client-check-cyclic-deps / check-cyclic-dependencies
  • GitHub Check: client-lint / client-lint
  • GitHub Check: client-unit-tests / client-unit-tests
  • GitHub Check: client-prettier / prettier-check
🔇 Additional comments (1)
app/client/src/widgets/wds/WDSTableWidget/config/settersConfig.ts (1)

17-20: I'll help you verify the review comment by examining how WDSTableWidget processes the pageNo property and checking for proper pagination handling.
<function_calls>

#!/bin/bash

Find WDSTableWidget implementation files

echo "=== Finding WDSTableWidget files ==="
fd -t f "WDSTableWidget" app/client/src/widgets/wds/ 2>/dev/null | head -20

echo -e "\n=== Directory structure ==="
find app/client/src/widgets/wds/WDSTableWidget -type f -name ".ts" -o -name ".tsx" 2>/dev/null | head -30


</function_calls>

<function_calls>

#!/bin/bash

Search for pageNo property handling in WDSTableWidget

echo "=== Searching for pageNo handling in WDSTableWidget ==="
rg -n "pageNo|updatePageNumber|onPageChange|setPageNumber" app/client/src/widgets/wds/WDSTableWidget/ -t ts -t tsx -A 3 -B 3 | head -100


</function_calls>

<function_calls>

#!/bin/bash

Check the settersConfig.ts file

echo "=== Current settersConfig.ts content ==="
cat -n app/client/src/widgets/wds/WDSTableWidget/config/settersConfig.ts | head -40


</function_calls>

@github-actions
Copy link

Deploy-Preview-URL: https://ce-41421.dp.appsmith.com

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
app/client/src/entities/DataTree/dataTreeWidget.test.ts (1)

558-561: LGTM! Setter config correctly added and transformed.

The setPageNumber setter configuration is properly structured with:

  • Path mapped to pageNo property
  • Type set to number
  • Correct transformation from relative path to absolute path (Table1.pageNo)

This follows the same pattern as other table setters like setData and setSelectedRowIndex.

Consider whether a disabled condition should be added (similar to setSelectedRowIndex which checks multiRowSelection). For example, should setPageNumber be disabled when the table has no data or only one page?

Also applies to: 604-607

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3edb7cc and 8ae3663.

📒 Files selected for processing (2)
  • app/client/src/entities/DataTree/dataTreeWidget.test.ts (2 hunks)
  • app/client/src/workers/Evaluation/__tests__/setters.test.ts (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: client-lint / client-lint
  • GitHub Check: client-unit-tests / client-unit-tests
  • GitHub Check: client-build / client-build
  • GitHub Check: client-prettier / prettier-check
  • GitHub Check: client-check-cyclic-deps / check-cyclic-dependencies
🔇 Additional comments (2)
app/client/src/workers/Evaluation/__tests__/setters.test.ts (2)

69-69: LGTM! Setter properly added to expected map.

The setPageNumber setter is correctly included in the test expectations alongside existing Table widget setters.


92-102: Implementation verified and correctly implemented.

The setPageNumber setter is properly configured in both TableWidgetV2 (app/client/src/widgets/TableWidgetV2/widget/index.tsx:568) and WDSTableWidget (app/client/src/widgets/wds/WDSTableWidget/config/settersConfig.ts:17), mapping to the pageNo property with type number. The test correctly verifies this mapping by calling setPageNumber(2) and asserting that pageNo equals 2.

@tomjose92 tomjose92 added the ok-to-test Required label for CI label Nov 26, 2025
@github-actions github-actions bot added Community Reported issues reported by community members Query Widgets & IDE Pod All issues related to Query, JS, Eval, Widgets & IDE Table Widget Table Widget V2 Issues related to Table Widget V2 Widgets & Accelerators Pod Issues related to widgets & Accelerators Widgets Product This label groups issues related to widgets labels Nov 26, 2025
…ter function has been introduced that can change the value.
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
app/client/src/widgets/TableWidgetV2/widget/propertyConfig/contentConfig.ts (1)

250-263: Polish the new pageNo control with help text (and optionally visibility rules)

The config itself looks fine and the numeric validation matches how pageNo is used. For UX consistency with the rest of the Pagination section, consider adding a short helpText, and, if this control is meant mainly for server-side pagination, optionally gate it behind serverSidePaginationEnabled like totalRecordsCount.

Example minimal tweak for clarity:

      {
        propertyName: "pageNo",
        label: "Page number",
        controlType: "INPUT_TEXT",
        isBindProperty: true,
        isTriggerProperty: false,
+        helpText: "Current page number (1-based). Can be controlled via JS (setPageNumber).",
        validation: {
          type: ValidationTypes.NUMBER,
          params: {
            min: 1,
            default: 1,
          },
        },
      },

If you decide it should only surface for server-side pagination, you could also mirror the pattern used on totalRecordsCount with hidden and dependencies.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8ae3663 and 695443a.

📒 Files selected for processing (1)
  • app/client/src/widgets/TableWidgetV2/widget/propertyConfig/contentConfig.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: perform-test / server-build / server-unit-tests
  • GitHub Check: perform-test / client-build / client-build
  • GitHub Check: perform-test / rts-build / build
  • GitHub Check: client-build / client-build
  • GitHub Check: client-prettier / prettier-check
  • GitHub Check: client-check-cyclic-deps / check-cyclic-dependencies
  • GitHub Check: client-unit-tests / client-unit-tests
  • GitHub Check: client-lint / client-lint

@tomjose92
Copy link
Contributor Author

/build-deploy-preview skip-tests=true

@github-actions
Copy link

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/19723414681.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 41421.
recreate: .

@github-actions
Copy link

Deploy-Preview-URL: https://ce-41421.dp.appsmith.com

@tomjose92 tomjose92 removed the ok-to-test Required label for CI label Nov 27, 2025
…e widget for users to quickly go to a later page. Also ensuring that whenever page changes for server side enabled page progrmatically, the onPageChange event gets triggered.
@tomjose92
Copy link
Contributor Author

/build-deploy-preview skip-tests=true

@github-actions
Copy link

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/19724978804.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 41421.
recreate: .

@github-actions
Copy link

Deploy-Preview-URL: https://ce-41421.dp.appsmith.com

@rahulbarwal
Copy link
Contributor

Screen.Recording.2025-11-27.at.11.08.12.AM.mov

This is not production-ready; I see multiple bugs.

  • When I start, I have the input, but pressing backspace initially shows zero. I don't understand why this happens; it shouldn't occur.

  • When I type any page number, it changes to one and disables the input. No matter how much I navigate backward or forward, the input remains disabled.

  • The selected row functionality behaves oddly with next and previous.

    • The selected row might be an existing bug and may not be relevant, but I want to be 100% sure about it.
    • When pressing previous or next, a selected row is visible in the update row form during the loading state.
    • Once the page loads, the selected row disappears.

@tomjose92
Copy link
Contributor Author

tomjose92 commented Nov 27, 2025

@rahulbarwal , regarding points 2 and 3, could you check if this happens with a newly created Table widget set up with server side pagination.
Reason is because I was not able to reproduce the above issue, and seems like it happens only when using it with a template or building block. Need to check why could that be happening

@github-actions
Copy link

github-actions bot commented Dec 5, 2025

This PR has not seen activitiy for a while. It will be closed in 7 days unless further activity is detected.

@github-actions github-actions bot added the Stale label Dec 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Community Reported issues reported by community members Enhancement New feature or request Query Widgets & IDE Pod All issues related to Query, JS, Eval, Widgets & IDE Stale Table Widget V2 Issues related to Table Widget V2 Table Widget Widgets & Accelerators Pod Issues related to widgets & Accelerators Widgets Product This label groups issues related to widgets

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Enable directly setting the page number in Table Widget

2 participants