To allow actions on multiple items at once, we provide the ability for the user to select rows in the datagrid. To make rows selectable in your datagrid, you need to do the following:
[clrDgItem]
input on each
<clr-dg-row>
component to tell us what model the user
is actually selecting. Most of the time, this will simply be the current data object in
the iteration.
[(clrDgSelected)]
two-way binding on the datagrid
itself, to have access to the list of currently selected items. Note that by adding
items to this list yourself, you can dynamically select elements if you need to.
In the following example, we simply display the names of the selected users, but since we have access to the full objects, we could perform any operation we want on them.
Selected users: No user selected. {{user.name}}