Agent Wranglers

APP-39Recommended

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". Then confirm or offer undo as Let people undo or confirm destructive actions says.

Examples

TypeScript 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`;

Python example

@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: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/app-ui/lists-and-tables/bulk-selection">Agent Wranglers web app interface playbook</a>. In code you write, add a comment next to it with the same link.