You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: update DataTable docs for badge array support and inferColumns render removal (#291)
- Correct accessor description: badge columns accept array return types; only
text/number/money/link reject arrays
- Fix compile error example comment to remove 'badge' from the list
- Update 'Combining type with inferColumns' section: inferColumns no longer
sets a default render function; it derives label, sort, filter, and id only
- Update inline comment and trailing note to remove references to 'default render'
Prompted by changesets:
- badge-array-support.md (BadgeOptions array support, inferColumns render removal)
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy file name to clipboardExpand all lines: docs/components/data-table.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -225,7 +225,7 @@ A column definition passed to `useDataTable`. `Column<TRow>` is a discriminated
225
225
|`width`|`number`| Fixed column width in pixels. Optional. |
226
226
|`align`|`"left" \| "right"`| Horizontal alignment. Defaults to `"right"` for `type: "number"` and `type: "money"`; `"left"` otherwise. Pass `"left"` to opt a numeric column out. |
227
227
|`truncate`|`boolean`| Truncate overflowing text with an ellipsis. Wires up an app-shell `<Tooltip>` automatically when the resolved cell value is a string or number — resolved via `accessor` first, then `row[col.id]` as a fallback — so hovering the cell reveals the full value. With `inferColumns`, no explicit `accessor` is needed because `id` is pinned to the field name. Requires another column to anchor the row width (`width` on a neighbor, or a fixed-size column like selection / row actions). |
228
-
|`accessor`|_(narrowed per `type`)_| Extracts the raw value. The return type is narrowed per `type` branch — returning an array or a plain object is a compile error on a typed column. Untyped columns (`type` omitted) retain `unknown`. `null` and `undefined` are always allowed.|
228
+
|`accessor`|_(narrowed per `type`)_| Extracts the raw value. The return type is narrowed per `type` branch — returning an array is a compile error on all typed columns except `badge`, and returning a plain object is a compile error on all typed columns. Untyped columns (`type` omitted) retain `unknown`. `null` and `undefined` are always allowed. |
229
229
|`sort`|`SortConfig`| Sort configuration. When set, the column header becomes clickable (Asc → Desc → off). |
230
230
|`filter`|`FilterConfig`| Filter configuration. When set, the column appears as an option in `DataTable.Filters`. |
column({ type: "number", accessor: (row) =>row.meta }); // row.meta is an object
283
283
```
@@ -444,13 +444,13 @@ column({
444
444
445
445
### Combining `type` with `inferColumns`
446
446
447
-
`inferColumns` (from `@tailor-platform/app-shell-sdk-plugin`) derives `label`, `sort`, `filter`, and a default `render` from TailorDB metadata. You can layer a `type` on top to swap the rendering without losing the inferred sort/filter config:
447
+
`inferColumns` (from `@tailor-platform/app-shell-sdk-plugin`) derives `label`, `sort`, `filter`, and `id` from TailorDB metadata. You can layer a `type` on top to get a built-in renderer without losing the inferred sort/filter config:
448
448
449
449
```tsx
450
450
const infer =inferColumns(tableMetadata.order);
451
451
452
452
const columns = [
453
-
// Inferred string column — keeps the default render
453
+
// Inferred column — displays row[id] as plain text
454
454
column(infer("reference")),
455
455
456
456
// Inferred datetime column, swapped to a `date` cell with long format
@@ -473,7 +473,7 @@ const columns = [
473
473
];
474
474
```
475
475
476
-
When you spread `...infer("field")`, drop in `accessor`if the inferred render doesn't already match what your `type` expects — built-in renderers read from `accessor` (or `row[id]`), not from the inferred `render`.
476
+
When you spread `...infer("field")`, add `accessor`when you want a typed renderer to read a specific value — built-in renderers read from `accessor` (or `row[id]`).
0 commit comments