Data table - Sorting
Data tables can sort rows by a column value.
Examples
Basic sorting
The sorting of your table can be controlled by the sort-by prop. This prop takes an array of objects, where each object has a key and order property, describing how the table is to be sorted.
The key corresponds to a column defined in the headers array, and order is either the string 'asc'
or 'desc'
indicating the order in which the items are sorted.
Unless you are using the multi-sort prop seen below, this array will almost always just have a single object in it.
Multi sort
Using the multi-sort prop will enable you to sort on multiple columns at the same time.
Ready for more?
Continue your learning with related content selected by the Team or move between pages by using the navigation links below.
Edit this page onGitHub