Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 0 additions & 22 deletions docs/content/components/Table.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,28 +228,6 @@ Here, the component displays rocket information coming from the official SpaceX
</App>
```

### `dataIdProperty` (default: "id") [#dataidproperty-default-id]

This property defines the name of the property in each data item that holds the unique ID for that item. By default, the property is set to `id`. If your data items do not have an `id` property, you can set this property to the name of the property that holds the unique ID for each item.

If the first 3 of the data items do not have such a property, the table will generate unique IDs based on the index of each item in the data array. Note that this may lead to issues when the data changes, as the indices may not remain consistent, thus an `id` should be provided.

```xmlui copy /dataIdProperty="key"/
<App>
<Table
dataIdProperty="key"
rowsSelectable="true"
data="{[
{ 'key': 0, 'name': 'John' },
{ 'key': 1, 'name': 'Jane' },
{ 'key': 2, 'name': 'Bill' },
]}"
>
<Column bindTo="name"/>
</Table>
</App>
```

### `enableMultiRowSelection` (default: true) [#enablemultirowselection-default-true]

This boolean property indicates whether you can select multiple rows in the table. This property only has an effect when the rowsSelectable property is set. Setting it to `false` limits selection to a single row.
Expand Down
2 changes: 1 addition & 1 deletion xmlui/src/components/Table/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const TableMd = createMetadata({
`unique IDs based on the index of each item in the data array. Note that this may lead to ` +
`issues when the data changes, as the indices may not remain consistent, thus an \`id\` should be provided.`,
valueType: "string",
defaultValue: defaultProps.dataIdProperty,
defaultValue: "id",
},
isPaginated: {
description: `This property adds pagination controls to the \`${COMP}\`.`,
Expand Down
3 changes: 2 additions & 1 deletion xmlui/src/components/Table/TableNative.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ const getCommonPinningStyles = (column: Column<RowWithOrder>): CSSProperties =>
export const Table = forwardRef(
(
{
dataIdProperty = defaultProps.dataIdProperty,
// TEMP: will be removed in favor of idKey
dataIdProperty,
data = defaultProps.data,
columns = defaultProps.columns,
isPaginated = defaultProps.isPaginated,
Expand Down