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
Copy file name to clipboardexpand all lines: website/docs/components/table/advanced-table/partials/code/how-to-use.md
+80-2
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,10 @@
1
1
## How to use this component
2
2
3
-
### Non-sortable Advanced Table
3
+
The Advanced Table is a component meant to display tabular data to overcome limitations with the HTML `<table>` elements and increase the accessibility for complex features, like nested rows and [a sticky header](#vertical-scrolling).
4
+
5
+
Instead of using the `<table>` elements, the Advanced Table uses `<div>`s with explicitly set roles (for example, instead of `<tr>`, it uses `<div role="row">`). This allows the Advanced Table to use [CSS Grid](https://developer.mozilla.org/en-US/docs/Web/CSS/grid) for styling.
6
+
7
+
### Basic Advanced Table
4
8
5
9
To use an Advanced Table, first define the data model in your route or model:
6
10
@@ -65,6 +69,43 @@ For clarity, there are a couple of important points to note here:
65
69
66
70
!!!
67
71
72
+
### Nested rows
73
+
For complex data sets where there is a parent row with several children, you can render them as nested rows. By default, the Advanced Table uses the `children` key on the `@model` argument to render the nested rows. To change the key used, set the `@childrenKey` argument on the Advanced Table.
74
+
75
+
To ensure the Advanced Table is accessible, the columns in the nested rows **must** match the columns of the parent rows. Otherwise the relationship between the parent and nested rows will not be clear to users.
76
+
77
+
!!! Warning
78
+
79
+
It is not currently supported to have `@isStriped`, `@isSelectable`, or sortable columns with nested rows. If your use case requires any of these features, please [contact the Design Systems Team](/about/support).
@@ -75,6 +116,12 @@ This component takes advantage of the `sort-by` helper provided by [ember-compos
75
116
76
117
Add `isSortable=true` to the hash for each column that should be sortable.
77
118
119
+
!!! Warning
120
+
121
+
At this time, the Advanced Table does not support sortable nested rows. If this is a use case you require, contact the Design System team.
122
+
123
+
!!!
124
+
78
125
```handlebars
79
126
<Hds::AdvancedTable
80
127
@model={{this.model.myDemoData}}
@@ -294,7 +341,38 @@ Consuming a large amount of data in a tabular format can lead to an intense cogn
294
341
295
342
We recommend using functionalities like [pagination](/components/pagination), [sorting](/components/table/advanced-table?tab=code#sortable-table), and [filtering](/patterns/filter-patterns) to reduce this load.
296
343
297
-
That said, there may be cases when it’s necessary to show an Advanced Table with a large number of columns and allow the user to scroll horizontally. In this case the consumer can place the Advanced Table inside a container with `overflow: auto`.
344
+
#### Vertical scrolling
345
+
346
+
For situations where the default number of rows visible may be high, it can be difficult for users to track which column is which once they scroll. In this case, the `hasStickyHeader` argument can be used to make the column headers persist as the user scrolls.
347
+
348
+
```handlebars
349
+
<!-- this is an element with "overflow: auto" and "max-height: 500px" -->
There may be cases when it’s necessary to show an Advanced Table with a large number of columns and allow the user to scroll horizontally. In this case the consumer can place the Advanced Table inside a container with `overflow: auto`.
0 commit comments