Sorting

To make a column to be sortable m-column component has property called sortable.

<m-column field="country" header="Country" sortable="true"></m-column>

Sorting a column triggers onSort event from m-table with sort info.

<m-table [value]=countries
         (onSort)="changeSort($event)">
</m-table>

Default Sorting To make a column sorted by default initially on load use sortField and sortOrder properties of m-table component.

<m-table [value]=countries
         sortField="country" [sortOrder]="1">
</m-table>

Server Side Sorting By default table columns are sorted locally, to disable local sorting and implement custom server side sorting use sortLocal property on m-table.

<m-table [value]=countries
         sortLocal="false">
</m-table>

Table Component m-table Properties

Name Default Description
@Input()
sortField: string
null Column to sort data by default.
@Input()
sortOrder: number
1 Order to sort when default sorting is enabled.
@Input()
sortLocal: boolean
true whether to sort locally or server side.
@Output()
onSort
- Emits sort info on sort.

Column Component m-column Properties

Name Default Description
@Input()
sortable: boolean
false whether column is sortable or not.

results matching ""

    No results matching ""