Blazor Table - Selection

Blazor Smart.Table Selection

Setup The Project

Follow the Getting Started guide to set up your Blazor Application with Smart UI.

Setup the Blazor Smart.Table

Follow the Get Started with Smart.Table guide to set up the component.


This tutorial will show you how to use the Table's Selection functionality.
First, you need to set the Selection property of the Table to true, like this:

    <Table OnReady="OnTableReady" Selection>
This will enable the default selection of the Table.
Table Selection
You can also set the SelectionMode property that is an enum with the following possible values:
  • TableSelectionMode.One
  • TableSelectionMode.Extended
  • TableSelectionMode.Many


Here is a full example of Table with selection mode extended:

  • Clicking on a checkbox selects a row and keeps the previous selection.
  • Clicking anywhere on a row except on its checkbox deselects all other rows.
  • Ctrl- and Shift-clicking selects multiple rows.
  • Clicking a selected row or its checkbox deselects it.
        <Table OnReady="OnTableReady" Selection="true" SelectionMode="TableSelectionMode.Extended" KeyboardNavigation="true">
                        <th scope="col">Country</th>
                        <th scope="col">Area</th>
                        <th scope="col">Population_Rural</th>
                        <th scope="col">Population_Total</th>
                        <th scope="col">GDP_Total</th>
                        <td>United States</td>
                        <td>United Kingdom</td>
    @code {
        private void OnTableReady(Table table)