Skip to content

feat: pivot table option to pin the totals row at the bottom (totals_row_position) - #9915

Merged
nishantmonu51 merged 2 commits into
mainfrom
nishantmonu51/pivot-totals-row-position
Sep 22, 2026
Merged

nishantmonu51 merged 2 commits into
mainfrom
nishantmonu51/pivot-totals-row-position

Conversation

@nishantmonu51

@nishantmonu51 nishantmonu51 commented Sep 21, 2026 •

Copy link
Copy Markdown
Collaborator

Adds a user-facing option to pin the pivot totals row at the bottom of the table instead of under the header.

  • New totalsRowPosition pivot state (top by default, or bottom), exposed as a Top/Bottom select next to the "Total row" checkbox in PivotToolbar.svelte.
  • Render-only change: the totals row stays tanstack row "0" in the data. When pinned to the bottom, NestedTable.svelte and FlatTable.svelte skip it in the virtualized body and render it in a sticky <tfoot> via a shared {#snippet pivotRow}, so expansion indices, click-to-filter, selection and heatmap domains are unaffected. Positional nth-of-type totals selectors are replaced by a .totals-row class.
  • Persisted in the URL (totals_row_position=bottom, omitted when top), the ExplorePreset proto and the bookmark DashboardState proto.
  • Canvas pivot and table components accept totals_row_position in YAML and show it in the inspector when the totals row is visible; project schema and component docs updated.
  • Explore YAML defaults are out of scope since the parser does not read any pivot preset fields today.
  • Tests: URL round-trip case in url-state-variations.spec.ts, and the pivot e2e run-through now toggles the position and asserts the footer row and URL param.

Checklist:

  • Covered by tests
  • Ran it and it works as intended
  • Reviewed the diff before requesting a review
  • Checked for unhandled edge cases
  • Linked the issues it closes
  • Checked if the docs need to be updated. If so, create a separate Linear DOCS issue
  • Intend to cherry-pick into the release branch
  • I'm proud of this work!

Adds a totalsRowPosition setting (top by default, or bottom) for pivot and
flat tables. The totals row stays tanstack row "0" in the data; when pinned
to the bottom it is skipped in the virtualized body and rendered in a sticky
tfoot, so expansion indices, click-to-filter and formatting are unaffected.

The setting is exposed in the pivot toolbar, persisted in the URL
(totals_row_position), the explore preset and bookmark protos, and the
canvas pivot/table YAML (totals_row_position).
</td>
{/each}
</tr>
{#if !(totalsRowAtBottom && row.index === 0)}

@AdityaHegde AdityaHegde Sep 22, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It feels weird to treat the first row as totals row regardless of totalsRowAtBottom. How about getting totals row separately instead of being part of rows? If it is a lot of refactor, a follow up will suffice.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

its a slightly med to large refactor, will do as a follow up to have just a clean refactor for that.

@nishantmonu51
nishantmonu51 merged commit cd3aec9 into main Sep 22, 2026
21 checks passed
@nishantmonu51
nishantmonu51 deleted the nishantmonu51/pivot-totals-row-position branch September 22, 2026 11:27
nishantmonu51 added a commit that referenced this pull request Sep 23, 2026
…_row_position`) (#9915)

* feat: pivot table option to pin the totals row at the bottom

Adds a totalsRowPosition setting (top by default, or bottom) for pivot and
flat tables. The totals row stays tanstack row "0" in the data; when pinned
to the bottom it is skipped in the virtualized body and rendered in a sticky
tfoot, so expansion indices, click-to-filter and formatting are unaffected.

The setting is exposed in the pivot toolbar, persisted in the URL
(totals_row_position), the explore preset and bookmark protos, and the
canvas pivot/table YAML (totals_row_position).

* chore: restore package-lock.json (unintended local drift)

(cherry picked from commit cd3aec9)
mahdi13 added a commit to inkitt/rill that referenced this pull request Sep 28, 2026
Conflicts:
- FlatTable.svelte, NestedTable.svelte: main moved the row markup into a
  pivotRow snippet (totals row pinning, rilldata#9915). Took main's snippet and
  applied the PIVOT_TOTALS_ROW_ID check there, and updated the comment that
  described the totals row as tanstack row "0".
- pivot-click-to-filter.spec.ts: main rewrote the setup for the unified
  filter manager (rilldata#9746). Took main's version and switched its row ids from
  positional to value-based again.
mahdi13 added a commit to inkitt/rill that referenced this pull request Sep 28, 2026
Conflicts:
- FlatTable.svelte, NestedTable.svelte: main moved the row markup into a
  pivotRow snippet (totals row pinning, rilldata#9915). Took main's snippet and
  applied the PIVOT_TOTALS_ROW_ID check there, and updated the comment that
  described the totals row as tanstack row "0".
- pivot-click-to-filter.spec.ts: main rewrote the setup for the unified
  filter manager (rilldata#9746). Took main's version and switched its row ids from
  positional to value-based again.
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.

2 participants