Tables: a search that matches nothing forgets the sort, and live narrowing on Companies drops the grouping #647

Closed
opened 2026-10-01 11:50:05 +00:00 by tiagoagueda · 0 comments
Owner

Found on 2026-10-01 while reviewing #313 at 0e789674a. Both are older than #313 and belong with #622 and #623: state that lives outside what a live filter swaps, or outside the form it sends.

1. A search that matches nothing forgets the sort

The hidden sort field is in the table's header (cotton/table/head.html:154), and the header is drawn only when there are rows. So are the header's filter boxes. When a narrowing leaves no rows, the next request has no sort.

Seen: at ?sort=-name, typing "zzzz" and then "aperture" left an address with no sort, and the table in its default order.

Fix: carry sort (and the header's filter values) somewhere that is drawn with or without rows, such as the filter form itself.

2. ?group= is dropped by any live narrowing on Companies

#company-filters has no group field, so a live filter, sort or search sends the request without it and the grouped view is lost. With scripts off, the masthead search of #313 does keep it (Table.search_keeps), so the two modes disagree.

Fix: a hidden group in the filter form, as view and state are carried on the other two pages.

Done when

Each case has a test, with scripts on and off: the sort survives an empty result and comes back with the rows, and group survives a live narrowing.

Found on 2026-10-01 while reviewing #313 at `0e789674a`. Both are older than #313 and belong with #622 and #623: state that lives outside what a live filter swaps, or outside the form it sends. ## 1. A search that matches nothing forgets the sort The hidden `sort` field is in the table's header (`cotton/table/head.html:154`), and the header is drawn only when there are rows. So are the header's filter boxes. When a narrowing leaves no rows, the next request has no `sort`. **Seen:** at `?sort=-name`, typing "zzzz" and then "aperture" left an address with no `sort`, and the table in its default order. **Fix:** carry `sort` (and the header's filter values) somewhere that is drawn with or without rows, such as the filter form itself. ## 2. `?group=` is dropped by any live narrowing on Companies `#company-filters` has no `group` field, so a live filter, sort or search sends the request without it and the grouped view is lost. With scripts off, the masthead search of #313 does keep it (`Table.search_keeps`), so the two modes disagree. **Fix:** a hidden `group` in the filter form, as `view` and `state` are carried on the other two pages. ## Done when Each case has a test, with scripts on and off: the sort survives an empty result and comes back with the rows, and `group` survives a live narrowing.
tiagoagueda added this to the 0.5.0 milestone 2026-10-01 11:50:05 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Postulo/postulo#647
No description provided.