Skip to content

Add filtered visible row count to grid totals#178

Merged
eviltester merged 3 commits into
masterfrom
171-total-grid-rows-count
Jun 10, 2026
Merged

Add filtered visible row count to grid totals#178
eviltester merged 3 commits into
masterfrom
171-total-grid-rows-count

Conversation

@eviltester

@eviltester eviltester commented Jun 10, 2026

Copy link
Copy Markdown
Owner

Add filtered visible row count when the grid is filtered.

Summary

  • show Filtered Visible alongside Total rows only when filters are active
  • cover both global text filtering and column header filters
  • add view, Storybook, and browser test coverage for the updated row summary

Fixes #171

Summary by CodeRabbit

  • New Features
    • Added a live "Total rows" status indicator displayed below the grid that dynamically updates whenever rows are added, removed, or when filters are applied
    • Enhanced filter feedback by displaying both total row count and filtered visible row count simultaneously when column-specific or quick filters are active

Copilot AI review requested due to automatic review settings June 10, 2026 09:04
@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@eviltester, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 2 minutes and 52 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 4dea1aee-4101-4731-be6a-b0099c32fabc

📥 Commits

Reviewing files that changed from the base of the PR and between ac84af3 and bd260b7.

📒 Files selected for processing (12)
  • apps/web/src/stories/data-grid-editor.stories.js
  • apps/web/src/stories/grid-row-visibility-summary.stories.js
  • apps/web/styles.css
  • docs/frontend-component-migration-plan.md
  • packages/core-ui/js/gui_components/data-grid-editor/data-grid-component-view.js
  • packages/core-ui/js/gui_components/data-grid-editor/grid-row-visibility-summary/grid-row-visibility-summary-controller.js
  • packages/core-ui/js/gui_components/data-grid-editor/grid-row-visibility-summary/grid-row-visibility-summary-view.js
  • packages/core-ui/js/gui_components/data-grid-editor/grid-row-visibility-summary/index.js
  • packages/core-ui/js/gui_components/data-grid-editor/tabulator/tabulator-helpers.js
  • packages/core-ui/src/tests/grid/grid-row-visibility-summary-controller.test.js
  • packages/core-ui/src/tests/grid/grid-row-visibility-summary.test.js
  • packages/core-ui/src/tests/grid/tabulator-duplicate-column-copy.test.js
📝 Walkthrough

Walkthrough

This PR implements a live "Total rows" counter beneath the data grid that displays the count of all rows, or "Total rows | Filtered Visible" when filters are active. The feature combines grid visibility metrics, filter-change notifications, component UI synchronization, test infrastructure, and comprehensive test coverage across units, functional, and Storybook tests.

Changes

Row Count Display Feature

Layer / File(s) Summary
Grid row visibility metrics
packages/core-ui/js/gui_components/data-grid-editor/tabulator/gridExtension-tabulator.js, packages/core-ui/js/gui_components/data-grid-editor/tabulator/tabulator-helpers.js
GridExtensionTabulator adds getTotalRowCount, getVisibleRowCount, hasActiveFilters, and getRowVisibilitySummary to expose row counts and filter state. TabulatorHelper adds getActiveGlobalFilterQuery() and clearGlobalFilterQuery() to access and reset the global filter query.
Grid change event notifications and filtering
packages/core-ui/js/gui_components/data-grid-editor/tabulator/gridExtension-tabulator.js
Filtering (filterText, clearFilters) and row operations (addRow, addRowsRelativeToSelection) now trigger grid-change notifications. A dataFiltered event listener is registered to notify observers when Tabulator's filter state changes.
Component view template and synchronization
packages/core-ui/js/gui_components/data-grid-editor/data-grid-component-view.js
Component template adds an aria-live total-rows display element. Constructor stores windowObj for animation scheduling. After grid ready, an onGridChanged callback schedules synchronization via requestAnimationFrame. syncTotalRows() reads row metrics and updates the display with total or filtered-visible counts. destroy() cleans up animation frames and grid-change subscriptions.
Test assertion infrastructure
apps/web/src/tests/browser/app/abstractions/components/grid-editor.component.js
GridEditorComponent adds totalRows locator and assertion methods: expectTotalRows(count) and expectFilteredVisibleRows({ totalRows, visibleRows }) to verify row counts in tests.
Unit tests for total rows UI
packages/core-ui/src/tests/grid/data-grid-component-view.test.js
FakeGridExtension expanded to track row metrics and support grid-change callbacks. New tests verify the total-rows label updates correctly when row counts change and when filter state toggles between active/inactive.
Functional test assertions
apps/web/src/tests/browser/app/functional/filtering-sorting/column-filter.spec.js, apps/web/src/tests/browser/app/functional/filtering-sorting/global-filter.spec.js, apps/web/src/tests/browser/app/functional/grid-editor/row-single-select-operations/add-single-row.spec.js, apps/web/src/tests/browser/app/functional/import-export/set-grid-from-text.spec.js, apps/web/src/tests/browser/app/functional/test-data/basic-generation.spec.js
Functional test suites now verify total row counts via expectTotalRows() after filtering, row operations, imports, and data generation.
Storybook story updates
apps/web/src/stories/data-grid-editor.stories.js
Stories coordinate rendering readiness via a __whenReady hook. Meta docs reference the live total-rows status. Story play functions await readiness and assert the total-rows element displays the expected count.
Test event listener expectations
packages/core-ui/src/tests/grid/tabulator-duplicate-column-copy.test.js
Test expectations updated to account for the additional dataFiltered event listener: tabulator.on call count increased to 4, and tabulator.off count increased to 4 for cleanup verification.

🎯 3 (Moderate) | ⏱️ ~25 minutes

🐰 A grid once bare now tells its tale,
With rows that count and filters scale,
Each change rings out, each sync takes flight,
The total rows shine in the light!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ 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%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately captures the main change: adding filtered visible row count display alongside total rows in the grid totals section.
Linked Issues check ✅ Passed The PR fully implements the requirements from #171: displays 'total rows' beneath the grid, keeps it updated on row creation/deletion/insertion/import/generation, and extends it with filtered visible row counts.
Out of Scope Changes check ✅ Passed All changes directly support the core objective of displaying and maintaining accurate row count totals. No extraneous modifications were detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 171-total-grid-rows-count

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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ac84af30d5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a live row-count status underneath the Tabulator-backed data grid, including a conditional “Filtered Visible” count when either the global quick filter or header column filters are active (addresses #171).

Changes:

  • Render and update a Total rows status element in DataGridComponentView, refreshing on grid changes via onGridChanged + requestAnimationFrame.
  • Extend the Tabulator grid extension to expose total/visible row counts, detect active filters, and trigger grid-change notifications on filter events.
  • Add/expand Jest, Storybook play, and Playwright browser coverage asserting total-row and filtered-visible behavior.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/core-ui/src/tests/grid/tabulator-duplicate-column-copy.test.js Updates expectations for the new dataFiltered grid-change listener.
packages/core-ui/src/tests/grid/data-grid-component-view.test.js Adds view tests asserting the total-row display and filtered-visible conditional rendering.
packages/core-ui/js/gui_components/data-grid-editor/tabulator/tabulator-helpers.js Adds global-filter query accessors used to detect active global filtering.
packages/core-ui/js/gui_components/data-grid-editor/tabulator/gridExtension-tabulator.js Implements total/visible row counting + active-filter detection and emits grid-change notifications on filtering.
packages/core-ui/js/gui_components/data-grid-editor/data-grid-component-view.js Renders the total-row status element and schedules syncs on grid changes.
apps/web/src/tests/browser/app/functional/test-data/basic-generation.spec.js Asserts total-row count after test data generation.
apps/web/src/tests/browser/app/functional/import-export/set-grid-from-text.spec.js Asserts total-row count after import and after malformed import reset behavior.
apps/web/src/tests/browser/app/functional/grid-editor/row-single-select-operations/add-single-row.spec.js Asserts total-row count updates after adding a row.
apps/web/src/tests/browser/app/functional/filtering-sorting/global-filter.spec.js Asserts “Filtered Visible” behavior for global quick filtering.
apps/web/src/tests/browser/app/functional/filtering-sorting/column-filter.spec.js Asserts “Filtered Visible” behavior for header column filtering (and combined with quick filter).
apps/web/src/tests/browser/app/abstractions/components/grid-editor.component.js Adds page-object helpers to assert total rows and filtered-visible rows in browser tests.
apps/web/src/stories/data-grid-editor.stories.js Updates Storybook play tests to wait for whenReady() and assert total-row text updates.

@greptile-apps

greptile-apps Bot commented Jun 10, 2026

Copy link
Copy Markdown

Greptile Summary

This PR introduces a GridRowVisibilitySummary MVC component that displays a live "Total rows" count below the data grid and conditionally adds a "Filtered Visible" count when global or column header filters are active. The implementation follows the existing Controller + View + createComponent pattern, uses requestAnimationFrame debouncing to coalesce rapid grid-change notifications, and fixes a pre-existing stale-state bug where clearFilters() did not reset the internal global-filter query tracker.

  • New component (grid-row-visibility-summary/): controller with normalization + view with ARIA role=status/aria-live=polite + factory index, covered by dedicated controller unit tests, DOM tests, Storybook stories (TotalOnly, FilteredVisible, InteractiveStateChange), and browser E2E assertions.
  • GridExtensionTabulator additions: getRowVisibilitySummary, getTotalRowCount, getVisibleRowCount, hasActiveFilters; subscribes to Tabulator's dataFiltered event; converts addRow / addRowsRelativeToSelection to return Promises so _notifyGridChanged fires only after the insertion completes.
  • DataGridComponentView integration: mounts the summary into a dedicated slot, subscribes to onGridChanged after the grid is ready, cancels any pending animation frame and unsubscribes the listener on destroy.

Confidence Score: 5/5

Safe to merge. All changed paths are additive, cleanup is thorough, and the rAF debounce correctly coalesces double notifications that arise from Tabulator's dataFiltered event and the explicit _notifyGridChanged calls firing in the same synchronous tick.

The new component follows the established MVC pattern with correct ARIA semantics, proper destroy-time cleanup (pending frame cancelled, subscription removed, summary component destroyed in the right order), and Promise propagation for async row insertion. The previously missing Storybook story for the filtered mode is now present. No unhandled edge cases or incorrect state transitions were found across the controller, view, integration, or E2E layers.

No files require special attention.

Important Files Changed

Filename Overview
packages/core-ui/js/gui_components/data-grid-editor/data-grid-component-view.js Integrates GridRowVisibilitySummary with rAF debouncing (scheduleSyncTotalRows), subscribes to onGridChanged after grid ready, and cleans up pending frames plus subscriptions on destroy.
packages/core-ui/js/gui_components/data-grid-editor/tabulator/gridExtension-tabulator.js Adds getTotalRowCount, getVisibleRowCount, hasActiveFilters, getRowVisibilitySummary; binds dataFiltered event; converts addRow/addRowsRelativeToSelection to return Promises so _notifyGridChanged fires after insertion. clearFilters now also calls clearGlobalFilterQuery to fix stale tracking.
packages/core-ui/js/gui_components/data-grid-editor/grid-row-visibility-summary/grid-row-visibility-summary-controller.js New MVC controller for the row summary; normalization, state, and display-text logic are all correct. Negative counts are clamped to 0 and non-numeric values are parsed safely.
packages/core-ui/js/gui_components/data-grid-editor/grid-row-visibility-summary/grid-row-visibility-summary-view.js New view layer; mounts into an injected root, sets ARIA attributes correctly (role=status, aria-live=polite), and cleans up all attributes on destroy.
apps/web/src/stories/grid-row-visibility-summary.stories.js New standalone Storybook file with TotalOnly, FilteredVisible, and InteractiveStateChange stories; play interactions verify both display modes and transitions.

Sequence Diagram

sequenceDiagram
    participant T as Tabulator
    participant GE as GridExtensionTabulator
    participant DGV as DataGridComponentView
    participant S as GridRowVisibilitySummary

    Note over DGV,S: mount() — grid ready
    DGV->>GE: onGridChanged(callback)
    DGV->>S: "update({totalRowCount:0, ...})"

    Note over T,DGV: User applies filter
    T-->>GE: dataFiltered event
    GE->>DGV: _notifyGridChanged → scheduleSyncTotalRows()
    DGV->>GE: getRowVisibilitySummary()
    GE-->>DGV: "{total:5, visible:2, hasActiveFilters:true}"
    DGV->>S: "update({totalRowCount:5, visibleRowCount:2, hasActiveFilters:true})"
    S-->>S: "render "Total rows: 5 | Filtered Visible: 2""

    Note over T,DGV: User clears filters
    GE->>GE: clearGlobalFilterQuery()
    GE->>DGV: _notifyGridChanged → scheduleSyncTotalRows() (rAF debounced)
    DGV->>GE: getRowVisibilitySummary()
    GE-->>DGV: "{total:5, visible:5, hasActiveFilters:false}"
    DGV->>S: "update({totalRowCount:5, visibleRowCount:5, hasActiveFilters:false})"
    S-->>S: render "Total rows: 5"

    Note over DGV,S: destroy()
    DGV->>DGV: cancelAnimationFrame, unsubscribeGridChanged
    DGV->>S: destroy()
Loading

Reviews (2): Last reviewed commit: "Add grid row visibility summary componen..." | Re-trigger Greptile

@eviltester eviltester merged commit 16e77d2 into master Jun 10, 2026
14 checks passed
@eviltester eviltester deleted the 171-total-grid-rows-count branch June 10, 2026 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ui grid improvement

2 participants