Open
Description
A Table input's current sort order is only tracked internally. This poses a problem if a notebook author wants to persist the current sort state, e.g. via a permalink.
Suggested solution
When the sort column or order is changed, dispatch a custom sort event:
new CustomEvent('sort', {bubbles: true, detail: {sort: currentColumnName, reverse: currentReverse}})
Workaround
The instantiating cell can listen to click
events and parse order and column name from event.target.textContent
. This technique is error prone and expected to break once additional features (like custom table names) have been added.
The workaround is currently implemented here: https://observablehq.com/@mootari/sortable-notebook-list#selection