Sorting the columns
You can make the Table sortable
with a callback that triggers whenever a
column is clicked. We ship the Table with a built-in sort mechanism, but you'll still need
to call it. The sort
method takes a column index and a direction. If you set
sortable
to false for one column, that column is unsortable.
The index
is the column index and the ascending
argument
alternates whenever the same col is clicked twice. If you manage your own sorting routine,
you can control the appearance of the column using selected
and
ascending
.
Importantly note that the cell values must all be declared as numbers in order to sort numerically. You can declare a hidden value while showing a human readable text using verbose syntax:
Custom sort
Standard sorting only deals with numbers and strings. If you need some kind of more
advanced sorting, for example if the
value
contains arrays or objects, you can implement custom sort per column
via the sort
method.