diff --git a/COMPONENT_INDEX.md b/COMPONENT_INDEX.md
index 3600d371..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 |
@@ -3864,12 +3866,14 @@ None.
### Props
-| Prop name | Required | Kind | Reactive | Type | Default value | Description |
-| :-------------- | :------- | :--------------- | :------- | ------------------------- | ------------------------------------------------ | ------------------------------------------------------ |
-| disableSorting | No | let
| No | boolean
| false
| Set to `true` to disable sorting on this specific cell |
-| scope | No | let
| No | string
| "col"
| Specify the `scope` attribute |
-| translateWithId | No | let
| No | () => string
| () => ""
| Override the default id translations |
-| id | No | let
| No | string
| "ccs-" + Math.random().toString(36)
| Set an id for the top-level element |
+| Prop name | Required | Kind | Reactive | Type | Default value | Description |
+| :-------------- | :------- | :--------------- | :------- | ---------------------------------------------------------- | ------------------------------------------------ | -------------------------------------- |
+| sortable | No | let
| No | boolean
| false
| Set to `true` for the sortable variant |
+| sortDirection | No | let
| No | "none" | "ascending" | "descending"
| "none"
| Specify the sort direction |
+| active | No | let
| No | boolean
| false
| Set to `true` if the column sorting |
+| scope | No | let
| No | string
| "col"
| Specify the `scope` attribute |
+| translateWithId | No | let
| No | () => string
| () => ""
| Override the default id translations |
+| id | No | let
| No | string
| "ccs-" + Math.random().toString(36)
| Set an id for the top-level element |
### Slots
diff --git a/docs/src/COMPONENT_API.json b/docs/src/COMPONENT_API.json
index 562853ce..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",
@@ -11843,9 +11867,33 @@
"filePath": "src/DataTable/TableHeader.svelte",
"props": [
{
- "name": "disableSorting",
+ "name": "sortable",
"kind": "let",
- "description": "Set to `true` to disable sorting on this specific cell",
+ "description": "Set to `true` for the sortable variant",
+ "type": "boolean",
+ "value": "false",
+ "isFunction": false,
+ "isFunctionDeclaration": false,
+ "isRequired": false,
+ "constant": false,
+ "reactive": false
+ },
+ {
+ "name": "sortDirection",
+ "kind": "let",
+ "description": "Specify the sort direction",
+ "type": "\"none\" | \"ascending\" | \"descending\"",
+ "value": "\"none\"",
+ "isFunction": false,
+ "isFunctionDeclaration": false,
+ "isRequired": false,
+ "constant": false,
+ "reactive": false
+ },
+ {
+ "name": "active",
+ "kind": "let",
+ "description": "Set to `true` if the column sorting",
"type": "boolean",
"value": "false",
"isFunction": false,
diff --git a/docs/src/pages/components/DataTable.svx b/docs/src/pages/components/DataTable.svx
index 52714f80..2c130b56 100644
--- a/docs/src/pages/components/DataTable.svx
+++ b/docs/src/pages/components/DataTable.svx
@@ -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.
+
+