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:
metonym 2022-06-05 13:37:50 -07:00 committed by GitHub
commit 72c24b83b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 241 additions and 48 deletions

View file

@ -85,6 +85,18 @@ export interface DataTableProps
*/
sortable?: boolean;
/**
* Specify the header key to sort by
* @default null
*/
sortKey?: DataTableKey;
/**
* Specify the sort direction
* @default "none"
*/
sortDirection?: "none" | "ascending" | "descending";
/**
* Set to `true` for the expandable variant
* Automatically set to `true` if `batchExpansion` is `true`