Skip to content

Filter row for large results tables and the Data Tables - #172

Merged
danyill merged 8 commits into
mainfrom
feat/table-filter-bar
Nov 7, 2026
Merged

danyill merged 8 commits into
mainfrom
feat/table-filter-bar

Conversation

@danyill

@danyill danyill commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Fixes #171. Stacked on #151 (lazy Data Tables cell widgets): merge #151 first.

What it adds

  • A per-column filter strip inside the table's own header, hidden until asked for (Ctrl+F on the table, or the header's right-click menu 'Filter rows'). No layout changes, so it lines up with the columns and follows resizing and scrolling.
  • Only for tables with more than 10 rows (MIN_FILTER_ROWS); small tables get nothing.
  • Expressions (pure Python, raptor/gui/table_filter.py): text (contains), Pump* / ? wildcards, "quoted phrase", !not, =exact, > >= < <= !=, 5..10, blank / nonblank; space = AND, | or , = OR. Numbers compare the cell's raw value when it has one, else the number in its text (commas, %, '>' censor mark, units ignored). A bad expression never raises: the box turns red, rows stay unfiltered.
  • Typing is debounced (150 ms). A pass hides rows with setRowHidden, copies no data: 30,000 rows filter in about 0.1 s. A 'Showing N of M / Clear' note appears while a filter is active.

Where

  • Results tables (_make_table: capacity, weak links, costs, importance) and the analytic per-element table.
  • Data Tables (Blocks, Nodes, Events, Sparing, PM): the Blocks and Sparing filters read the model objects the rows were filled from, so hidden rows never build their cell widgets and widget columns (distribution, parameters, PM frequency) can be filtered. Sparing filters Name, ID and Sparing Type only; its other columns are widgets with no model text, so their boxes are disabled. CSV export reads only visible rows and its dialog title says 'only the N of M rows the filter shows'. An edited row that stops matching stays visible until the next time the user types in a filter box.
  • Not changed: the event log (already has its own model-based filter), Phases and the other small tables. Mass Edit works on the canvas selection, not on table rows, so there is nothing to scope.

Tests: 54 expression tests, 15 for the bar, results hook and Data Tables.

A per-column filter strip in the table's own header (Ctrl+F or the header
menu), for tables of more than 10 rows. Expressions: text, wildcards, quoted
phrases, !, =, >, >=, <, <=, a..b ranges, blank/nonblank, space = AND,
| or , = OR. Typing is debounced (150 ms); a pass hides rows with
setRowHidden and copies no data. A 'Showing N of M - Clear' note shows while
a filter is active.

Results tables (via _make_table) and the analytic per-element table use the
cell text and exact raw values. The Data Tables filter the model objects the
rows were filled from, so hidden rows never build their cell widgets, and CSV
export reads only the visible rows (and says so). An edited row that stops
matching stays shown until the next time the user types.
@danyill
danyill deleted the branch perf/data-table-lazy-widgets November 7, 2026 07:09
@danyill danyill closed this Nov 7, 2026
@danyill danyill reopened this Nov 7, 2026
@danyill
danyill changed the base branch from perf/data-table-lazy-widgets to main November 7, 2026 07:22
@danyill
danyill merged commit f8bef40 into main Nov 7, 2026
48 checks passed
@danyill
danyill deleted the feat/table-filter-bar branch November 7, 2026 10:32
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.

Filter bar for large results and data tables

1 participant