Skip to content

feat(datagrid): redesign filter panel header and row actions#1649

Merged
datlechin merged 4 commits into
TableProApp:mainfrom
J2TeamNNL:fix/datagrid-d13-filter-panel
Jun 15, 2026
Merged

feat(datagrid): redesign filter panel header and row actions#1649
datlechin merged 4 commits into
TableProApp:mainfrom
J2TeamNNL:fix/datagrid-d13-filter-panel

Conversation

@J2TeamNNL

Copy link
Copy Markdown
Contributor

Changes

Implements the new filter panel interaction model:

Clear vs Remove All

  • "Unset" renamed to "Clear": calls clearAppliedFilters() — keeps all filter rows, just removes the applied state so the table returns to unfiltered results.
  • New "Remove All Filters" item added to the ... options menu: calls clearFilterState() — removes all filter rows entirely.

Per-row Apply moved to context menu

  • Per-row Apply / Applied buttons removed from the inline row layout.
  • "Apply Only This Filter" added to each row's right-click context menu (calls the existing applySoloFilter path).

Tri-state toggle-all checkbox

  • SF Symbols button (checkmark.square.fill / square / minus.square.fill) added to the filter panel header.
  • Shows checked when all rows are enabled, unchecked when none are, dash when mixed.
  • Clicking toggles all rows to enabled (if any are off) or all to disabled (if all are on).

Files: TablePro/Views/Filter/FilterPanelView.swift, TablePro/Views/Filter/FilterRowView.swift

Test plan

  • Click "Clear" — filter rows stay, table reloads without filters; button is disabled when no filters applied
  • ... menu > "Remove All Filters" — all rows removed, table reloads unfiltered
  • Right-click a filter row > "Apply Only This Filter" — only that filter is applied
  • With all rows enabled: tri-state shows checkmark; clicking disables all
  • With no rows enabled: tri-state shows empty square; clicking enables all
  • With mixed enabled state: tri-state shows dash; clicking enables all

J2TeamNNL and others added 2 commits June 10, 2026 22:26
- Rename 'Unset' -> 'Clear': calls clearAppliedFilters() (keeps rows, returns
  to unfiltered); old clearFilterState() moved to 'Remove All Filters' in ... menu
- Remove per-row Apply/Applied buttons; 'Apply Only This Filter' added to row
  context menu via rightMouseDown
- Tri-state checkbox in header toggles all filter rows enabled/disabled at once
Signed-off-by: Ngô Quốc Đạt <datlechin@gmail.com>

@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: 3cd715afb9

ℹ️ 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".

Button("Unset") {
coordinator.clearFilterState()
Button("Clear") {
coordinator.clearAppliedFilters()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Defer clearing applied filters until reload is confirmed

When there are unsaved row edits, onUnset() routes to clearFiltersAndReload(), which can be canceled by confirmDiscardChangesIfNeeded. Because this line clears the commit before that confirmation completes, canceling the prompt leaves the grid still running the old filtered query while the panel reports no applied filters and disables Clear. Move the state clear into the confirmed path (or roll it back on cancel) so UI state and the query stay in sync.

Useful? React with 👍 / 👎.

@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: e76906c8f1

ℹ️ 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".


Button(role: .destructive) {
coordinator.clearFilterState()
onUnset()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Avoid reloading when removing unapplied filter rows

When the menu is used while the panel only has draft rows (for example the auto-added blank row before anything has been applied), this still invokes onUnset(), which MainContentView wires to clearFiltersAndReload(). That path prompts to discard unsaved row edits, resets pagination, and runs a query even though no applied filter is affecting the table, so a harmless row cleanup can force a data reload/possible discard. Gate the reload on filterState.hasAppliedFilters and just clear the local rows otherwise.

Useful? React with 👍 / 👎.

@datlechin datlechin merged commit 3593c56 into TableProApp:main Jun 15, 2026
3 checks passed

@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: 4daced2a35

ℹ️ 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".

Comment on lines +74 to +75
updated.isEnabled = newState
coordinator.updateFilter(updated)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep Clear/Apply available after disabling all applied filters

When the table is filtered via an .all commit and every applied row is enabled, clicking the new header checkbox reaches this path and flips every row to isEnabled = false without reloading. Because hasAppliedFilters is derived from the now-disabled rows, the panel immediately reports no applied filters and disables both Clear and Apply, while the grid is still showing the old filtered query; users then have to remove the rows or re-enable a filter to get back to an unfiltered table. Keep the applied-state controls in sync with the actual query, or allow this toggle to trigger/enable the clear reload path.

Useful? React with 👍 / 👎.

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