Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Result Table

The lens-result-table component displays a paginated and sortable table of totals from the LensResult. It uses the configured Lens options and listens to the ResultStore.

The table is setup with some props and some via the options. For exmaple the Columns are defined in the table options.

The table is automatically populated with data sources that are marked as claimed in the ResultStore. You can provide user-friendly labels for internal site keys via the siteMappings option.

If a data source has not yet been fully claimed, the table shows a "loading" message. This message is customizable via the translation key loading, see translation.

Each row includes a checkbox to select that data source for a data request. The selection is tracked in the DataRequestStore.


Props

PropTypeDefaultDescription
titlestring""Optional title displayed above the table.
pageSizenumber10Number of rows per page.
pageSizeSwitcherbooleanfalseIf true, enables a dropdown to change the number of rows shown.

Slots

Slot NameDescription
lens-result-above-paginationRenders content above the pagination controls.
beneath-paginationRenders content below the pagination controls.

Example

To use the table, define the tableOptions and include the component in your HTML:

"tableOptions": {
    "headerData": [
        {
            "title": "Sites",
            "dataKey": "site"
        },
        {
            "title": "Patients",
            "dataKey": "patients"
        }
    ]
}
<lens-result-table title="Result Table" pageSize={25} pageSizeSwitcher={true} />

Styling

Part NameDescription
lens-result-table-titleThe title heading above the table.
lens-result-tableThe table element itself.
lens-result-table-headerThe <thead> element.
lens-result-table-header-rowThe header row <tr>.
lens-result-table-header-cellGeneric header cells.
lens-result-table-header-cell-checkboxHeader cell containing the "select all" checkbox.
lens-result-table-header-datatypeHeader cells for data type columns (sortable, may include info buttons).
lens-result-table-header-checkboxThe checkbox used to select all rows.
lens-result-table-table-bodyThe <tbody> containing the data rows.
lens-result-table-paginationContainer for pagination controls.
lens-result-table-pagination-buttonPrevious and next arrow buttons.
lens-result-pagination-pagination-previousSpecifically styles the "previous" button.
lens-result-pagination-pagination-nextSpecifically styles the "next" button.
lens-result-table-pagination-pagenumberDisplays the current page number and total page count.
lens-result-table-pagination-switcherContainer for the page size switcher dropdown.