mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 18:31:06 +00:00
feat(data-table): support programmatic sorting (#1337)
* refactor(data-table): pass down sortable props instead of using context * feat(data-table): support programmatic sorting * test(data-table): assert new props * docs(data-table): add "Programmatic sorting" example * refactor(data-table): remove unused tableSortable store * refactor(data-table): remove unused indices
This commit is contained in:
parent
d2cdb8eb0f
commit
72c24b83b2
9 changed files with 241 additions and 48 deletions
|
@ -1075,6 +1075,18 @@ and then limit displayed content by using `pageSize` and `page` props, which are
|
|||
]}"
|
||||
/>
|
||||
|
||||
### Programmatic sorting
|
||||
|
||||
Use the reactive `sortKey` and `sortDirection` props for programmatic sorting.
|
||||
|
||||
By default, the table is not sorted by a specific key. The `sortKey` value must be a valid `key` specified in the `headers` object.
|
||||
|
||||
Possible values for `sortDirection` include `"none"` or `"ascending"` or `"descending"`.
|
||||
|
||||
Setting `sortKey` to `null` and `sortDirection` to `"none"` should reset the table rows to their initial order.
|
||||
|
||||
<FileSource src="/framed/DataTable/DataTableProgrammaticSorting" />
|
||||
|
||||
### Empty column with overflow menu
|
||||
|
||||
Some use cases require an empty column in the table body without a corresponding table header.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue