GitHub user splatter0 created a discussion: [Interactive Table] Improve 
server-side filtering, add Clear All, and support page/grand totals

## Summary

The AG Grid Interactive Table is designed for large, server-paginated datasets, 
but three common enterprise-table capabilities are currently missing or 
incomplete:

1. Column filters can execute server-side queries before users finish entering 
conditions.
2. There is no one-click action to clear all table-level filters.
3. Raw Records mode cannot display both current-page subtotals and filtered 
grand totals.

These capabilities form one complete workflow: users apply filters, reset 
filters, and reconcile detailed rows against totals.

## 1. Configurable server-side filter application

### Current behavior

With server-side pagination enabled, AG Grid column filter changes 
automatically trigger Superset queries.

There is no chart option for:

- Applying filters manually
- Applying on Enter
- Configuring debounce time

While entering a value such as `customer001`, intermediate values may trigger 
filter changes before input is complete.

Each change may execute:

- Page data query
- Row-count query
- Summary query when `Show summary` is enabled

### Why this is needed

Interactive Table targets large datasets, often backed by production databases 
or metered cloud warehouses.

Executing incomplete conditions can cause:

- Unnecessary database load and warehouse cost
- Multiple concurrent requests from one user action
- Repeated loading while the user is typing
- Stale-request race conditions
- Significant load in embedded dashboards with many users

### Proposed solution

Add a chart option:

```text
Column filter apply mode:
- Instant
- Debounced
- Manual
```

Suggested behavior:

- Client-side pagination may continue using Instant mode.
- Server-side pagination should default to Debounced or Manual mode.
- Debounce duration should be configurable, for example 300–1000 ms.
- Manual mode should provide Apply and Reset buttons.
- Pressing Enter should apply the filter.
- Only the latest request should update the chart.

## 2. One-click Clear All filters

### Current behavior

Users can reset individual column filters, but there is no global action to 
clear all Interactive Table filters.

Resetting dashboard native filters does not reliably clear AG Grid's internal 
column-filter state.

### Why this is needed

A table can have many filters hidden inside different column menus. Without a 
global reset:

- Users must inspect every column individually.
- Users may not understand why rows are missing.
- Persisted filter state can make the table appear unexpectedly filtered.
- Clearing filters individually can trigger several unnecessary queries.
- Embedded users do not have a simple way to restore the initial table state.

A global reset is standard behavior for enterprise data grids.

### Proposed solution

Add a visible action:

```text
Clear all filters
```

It should clear:

- All AG Grid column filters
- Interactive Table search text
- Related server-side filter state
- Current page, returning to page 1

All state should be cleared first, followed by only one chart refresh.

An active-filter count would improve discoverability:

```text
Clear all filters (3)
```

Sorting should remain unchanged or be handled through a separate `Reset table 
state` action.

## 3. Current-page subtotal and filtered grand total in Raw Records mode

### Current behavior

In Superset 6.1.0, `Show summary` is available only in Aggregate mode.

Aggregate mode changes the data grain, so users lose transaction-level, 
invoice-level, or order-level details.

PR #41754 adds full summary support to Raw Records mode, but it still does not 
provide a current-page subtotal. AG Grid column filters are also excluded from 
the totals query.

### Why this is needed

Detailed rows and totals must often be displayed together for:

- Financial transactions
- Invoices
- Orders
- Payments
- Accounting entries
- Sales records
- Inventory movements

Users need to reconcile the visible rows while also seeing the total value of 
every matching record.

Aggregate mode is not an alternative because it removes detail rows. A separate 
Big Number chart is also insufficient because internal Interactive Table column 
filters are not automatically applied to another chart.

### Proposed solution

Allow Raw Records mode to display two labelled pinned rows:

| Summary | Amount | Tax |
|---|---:|---:|
| Current page subtotal | 12,345.00 | 1,234.50 |
| Filtered grand total | 987,654.00 | 98,765.40 |

Definitions:

- **Current page subtotal**: aggregation of rows displayed on the current page.
- **Filtered grand total**: aggregation across all rows matching dashboard 
filters, native filters, table search, and supported AG Grid column filters, 
independent of pagination and row limit.

For each numeric column, allow selecting:

```text
None
Sum
Average
Min
Max
Count
```

This should be optional because a filtered grand-total query may be expensive.

### Expected behavior

- Page subtotal updates immediately when the page changes.
- Filtered grand total updates after the final filter is applied.
- Both totals respect the final applied filter state.
- Currency and number formatting match their columns.
- Non-additive numeric fields are not summed unless configured.
- A loading indicator appears while the grand-total query is running.

## Suggested acceptance criteria

- [ ] Server-side column filters support Debounced or Manual mode.
- [ ] Manual mode does not query while the condition is being entered.
- [ ] A single action clears all table filters and search state.
- [ ] Clear All causes only one final refresh.
- [ ] Raw Records mode supports current-page subtotals.
- [ ] Raw Records mode supports filtered grand totals.
- [ ] Grand totals respect supported AG Grid column filters.
- [ ] Aggregation is configurable per numeric column.
- [ ] The behavior works with server-side pagination and embedded dashboards.

## References

- Server-side column filtering: https://github.com/apache/superset/pull/35683
- Related visible-row summary request: 
https://github.com/apache/superset/issues/33289
- Raw Records full-summary implementation: 
https://github.com/apache/superset/pull/41754

GitHub link: https://github.com/apache/superset/discussions/42271

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: 
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to