Agent Wranglers

Lists and tables Recommended

Say what select all selects

When people select all rows, say whether that means this page or every matching record, and show the count before any bulk action.

How to do it

The header checkbox selects the visible page. Then offer a link to select every match, such as "Select all 2,340 orders". For every match, send the filter to the server, not a list of IDs. The server applies the filter again with the user's permissions. Name the count on the action button, such as "Archive 2,340 orders".

Example

type Selection = { kind: 'ids'; ids: string[] } | { kind: 'matching'; filters: OrderFilters; count: number };

export const archiveLabel = (selection: Selection) =>
  `Archive ${selection.kind === 'ids' ? selection.ids.length : selection.count} orders`;
@app.post("/api/orders/archive")
def archive_orders():
    body = request.json
    if body["kind"] == "matching":
        query = order_query_for(current_user(), OrderFilters(**body["filters"]))
    else:
        query = order_query_for(current_user()).where(Order.id.in_(body["ids"]))
    return {"archived": orders.archive(query)}

How to check

A browser test selects all on a filtered list of 120 records with 50 per page, then picks every match. The button says 120, and the server archives exactly those 120.

For agents: if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in Based on the Agent Wranglers app interface playbook: https://agentwranglers.se/playbook/app-ui/lists-and-tables/bulk-selection.