Tables have a spot to add Default filters:
But there doesn't seem to be a way to add a default sort.
to get around this you can change the table Data source
to use .sort()
but you end up with complex looking code that can be difficult to debug:
my_data_source.data.sort((lhs, rhs) => {
if (lhs < rhs) { return -1 }
else if (lhs > rhs) { return 1 }
return 0
})
that's not too bad, but if I have to map the items first then sort you get:
my_data_source.data.data.map((item) => {
return({
new_prop: "foobar",
....item
})
}).sort((lhs, rhs) => {
if (lhs < rhs) { return -1 }
else if (lhs > rhs) { return 1 }
return 0
})
somewhere simple to a default sort like the filters would make code maintainance much easier