Row Selection

Row selection can be enabled using selectable property in m-table component.

<m-table [value]=countries
         selectable="true">
</m-table>

Selected rows are bound to the selection property of m-table component.

<m-table [value]=countries
         selectable="true" [(selection)]="selectedRows">
</m-table>

selecting/unselecting triggers onRowSelect, onRowUnselect, selectionChange events from m-table component.

<m-table [value]=countries
         selectable="true" (onRowSelect)="rowSelect($event)" (onRowUnselect)="rowUnselect($event)" (selectionChange)="onSelectionChange($event)">
</m-table>

Selection Mode

By default selection mode is multiple, to change selection mode to single selection use selectionMode property in m-table component.

<m-table [value]=countries
         selectable="true" selectionMode="single">
</m-table>

Selection Handler

By default selection handler is enabled which is checkbox. To remove this selection handler and use row click to select, use selectionHandler property in m-table component.

<m-table [value]=countries
         selectable="true" selectionHandler="false">
</m-table>

Table Component m-table Properties

Name Default Description
@Input()
selectable: boolean
true whether data table is selectable or not.
@Input()
selectionMode: string
'multiple' Defines the selection mode, valid values are 'single' and 'multiple'.
@Input()
selectionHandler: boolean
true whether selection handler (which is checkbox) is enabled or not
@Output()
onRowSelect
- Emits event on select of row with selected row data.
@Output()
onRowUnselect
- Emits event on unselect of row with unselected row data.
selection - Binds to selected rows.

results matching ""

    No results matching ""