Selection (Single)

Depending on the use case, you might want to restrict the user to only allow single selection in a datagrid. If you haven't done so, please read the previous section on general selection first.

In the following example, we simply display the name of the selected user, but since we have access to the full objects, we could perform any operation we want on it.

Client side, no trackBy

Selected user: No user selected. {{singleSelected.name}}

User ID Name Creation date Favorite color {{user.id}} {{user.name}} {{user.creation | date}} {{users.length}} users

Client side, trackBy index

Selected user: No user selected. {{trackByIndexSingleSelected.name}}

User ID Name Creation date Favorite color {{user.id}} {{user.name}} {{user.creation | date}} {{users.length}} users

Client side, trackBy item

Selected user: No user selected. {{trackByIdSingleSelected.name}}

User ID Name Creation date Favorite color {{user.id}} {{user.name}} {{user.creation | date}} {{users.length}} users

Server-driven, trackBy item

Selected user: No user selected. {{trackByIdServerSingleSelected.name}}

User ID Name Creation date Favorite color {{user.id}} {{user.name}} {{user.creation | date}} {{pagination.firstItem + 1}} - {{pagination.lastItem + 1}} of {{total}} users