diff --git a/COMPONENT_INDEX.md b/COMPONENT_INDEX.md index 75781dcc..2ee61315 100644 --- a/COMPONENT_INDEX.md +++ b/COMPONENT_INDEX.md @@ -967,6 +967,8 @@ export interface DataTableCell { | selectable | No | let | Yes | boolean | false | Set to `true` for the selectable variant
Automatically set to `true` if `radio` or `batchSelection` are `true` | | expandedRowIds | No | let | Yes | ReadonlyArray | [] | Specify the row ids to be expanded | | expandable | No | let | Yes | boolean | false | Set to `true` for the expandable variant
Automatically set to `true` if `batchExpansion` is `true` | +| sortDirection | No | let | Yes | "none" | "ascending" | "descending" | "none" | Specify the sort direction | +| sortKey | No | let | Yes | DataTableKey | null | Specify the header key to sort by | | headers | No | let | No | ReadonlyArray | [] | Specify the data table headers | | rows | No | let | No | ReadonlyArray | [] | Specify the rows the data table should render
keys defined in `headers` are used for the row ids | | size | No | let | No | "compact" | "short" | "medium" | "tall" | undefined | Set the size of the data table | diff --git a/docs/src/COMPONENT_API.json b/docs/src/COMPONENT_API.json index 0e659208..56d29bac 100644 --- a/docs/src/COMPONENT_API.json +++ b/docs/src/COMPONENT_API.json @@ -2421,6 +2421,30 @@ "constant": false, "reactive": false }, + { + "name": "sortKey", + "kind": "let", + "description": "Specify the header key to sort by", + "type": "DataTableKey", + "value": "null", + "isFunction": false, + "isFunctionDeclaration": false, + "isRequired": false, + "constant": false, + "reactive": true + }, + { + "name": "sortDirection", + "kind": "let", + "description": "Specify the sort direction", + "type": "\"none\" | \"ascending\" | \"descending\"", + "value": "\"none\"", + "isFunction": false, + "isFunctionDeclaration": false, + "isRequired": false, + "constant": false, + "reactive": true + }, { "name": "expandable", "kind": "let", diff --git a/types/DataTable/DataTable.svelte.d.ts b/types/DataTable/DataTable.svelte.d.ts index 9a0a588b..e3be8ebf 100644 --- a/types/DataTable/DataTable.svelte.d.ts +++ b/types/DataTable/DataTable.svelte.d.ts @@ -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`