Skip to main content

Selection

Row selection marks records independently from the current record used for navigation and editing. This makes it suitable for exports, batch commands, bulk updates, or any workflow that operates on a set of records.

Row selection
Loading FDC sample…
FdcGrid(
dataSet: customers,
options: const FdcGridOptions(readOnly: true),
columns: customerColumns,
rowIndicator: const FdcGridRowIndicator(
visible: true,
options: FdcGridRowIndicatorOptions(
showRowNumbers: true,
showRowSelect: true,
),
),
);

Enable row selection

Enable selection controls through the leading row indicator:

FdcGrid(
dataSet: customers,
rowIndicator: const FdcGridRowIndicator(
visible: true,
options: FdcGridRowIndicatorOptions(
showRowNumbers: true,
showRowSelect: true,
),
),
)

The header selection control selects or clears the visible selection set, while each row checkbox toggles that record. The dataset current record remains independent, so keyboard navigation and editing do not implicitly change multi-row selection. See Row Indicator for the complete leading-region configuration model.

Selection API

Use the dataset selection API from application commands:

dataSet.selection.selectCurrent();
dataSet.selection.unselectCurrent();
dataSet.selection.toggleCurrent();

final selectedCustomers = dataSet.selection.rows();

rows() returns value snapshots, which are appropriate for export and batch-action workflows without exposing mutable dataset internals.

For cell-oriented spreadsheet workflows, see Range Selection.

Paged selection

PRO

Paged datasets cannot infer the complete selected row set from the currently loaded page. FDC therefore stores selection by record key and uses two different execution strategies when selection state becomes part of the dataset filter.

Show selected rows only:

await dataSet.filter
.selected(true)
.apply();

For a paged dataset, selected(true) is an adapter-side include-only query. The dataset sends the selected record keys through the load request, and the adapter must advertise selectedKeyFiltering capability. An empty selected-key set produces an empty result.

Show unselected rows:

await dataSet.filter
.selected(false)
.apply();

selected(false) is intentionally different. The adapter loads the normal page and the dataset removes selected records from that page locally. This means a visible page can contain fewer rows than the configured page size after selected records are excluded.

This hybrid behavior avoids requiring every backend to implement a potentially large NOT IN key query while keeping selected(true) correct across page boundaries.

Aggregates with paged selection

For selected(true), paged aggregate queries also use the selected-key include predicate and therefore require adapter support for both selected-key filtering and aggregates.

For selected(false), summaries are calculated from the current locally visible page after selected rows have been removed. They do not issue a backend aggregate query that would ignore the local exclusion step.

Selection is still independent from the current row

Paged selection does not change the core selection model: moving the dataset cursor, editing a current record, or navigating between pages does not implicitly select or unselect rows. Selection remains a separate key-based state used by batch workflows and selection-aware filters.