Nested prop
You may have nested properties that you need to sort specifically.
field
can be set as a callback with row
as argument:
const field = (row) => row.nested.prop
Example
const sort = table.createSort((row) => row.user.login_count)
User |
---|
{ name: "John Doe", login_count: 120 } |
{ name: "Tobie Vint", login_count: 24 } |
{ name: "Zacharias Cerman", login_count: 598 } |
{ name: "Gérianna Bunn", login_count: 347 } |
{ name: "Bee Saurin", login_count: 2 } |
{ name: "Méyère Granulette", login_count: 1085 } |
{ name: "Jane Doe", login_count: 271 } |
{ name: "Michel Trapu", login_count: 637 } |