Client-side column sorting for a <table data-hl-table>. Headers marked
data-hl-sort (with an optional column key as the value) become sortable:
the header is made focusable, exposes aria-sort, and toggles between
ascending and descending on click, Enter, or Space. Rows in the <tbody>
are reordered by the cell's data-hl-value (falling back to its text),
comparing numerically when both sides are numbers. Rows added later are
sorted into place. Without JavaScript the table simply renders in authored
order, which setValue(null) restores. The sort is observable through
onValueChange/hl:change. Markup can set data-hl-default-value
("column" or "column:descending") on the table.
Client-side column sorting for a
<table data-hl-table>. Headers markeddata-hl-sort(with an optional column key as the value) become sortable: the header is made focusable, exposesaria-sort, and toggles between ascending and descending on click, Enter, or Space. Rows in the<tbody>are reordered by the cell'sdata-hl-value(falling back to its text), comparing numerically when both sides are numbers. Rows added later are sorted into place. Without JavaScript the table simply renders in authored order, whichsetValue(null)restores. The sort is observable throughonValueChange/hl:change. Markup can setdata-hl-default-value("column"or"column:descending") on the table.