Skip to content

Commit 61aeb64

Browse files
authored
Website: AdvancedTable max height argument docs (#2872)
1 parent 385a527 commit 61aeb64

File tree

3 files changed

+54
-63
lines changed

3 files changed

+54
-63
lines changed

website/app/styles/pages/components/advanced-table.scss

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,6 @@
66
// COMPONENTS > TABLE > ADVANCEDTABLE
77

88
#show-content-components-table-advanced-table {
9-
.doc-advanced-table-scrollable-wrapper {
10-
overflow-x: auto;
11-
}
12-
13-
.doc-advanced-table-vertical-scrollable-wrapper {
14-
height: 500px;
15-
}
16-
179
.doc-advanced-table-multiselect-with-pagination-demo {
1810
.hds-advanced-table + .hds-pagination {
1911
margin-top: 16px;

website/docs/components/table/advanced-table/partials/code/component-api.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,11 @@ The Advanced Table component itself is where most of the options will be applied
9292
Determines if even-numbered rows will have a different background color from odd-numbered rows.<br><br>
9393
**Important**: Advanced Table does **not** support setting `isStriped` to true when there are nested rows.
9494
</C.Property>
95-
<C.Property @name="hasStickyHeader" @type="boolean" @default="false">
96-
Determines if the Advanced Table has a sticky header.
95+
<C.Property @name="maxHeight" @type="string">
96+
Sets the maximum height of the Advanced Table. If the `@maxHeight` is set, there will automatically be a sticky header. To turn off the sticky header and still have a max height, set `@hasStickyHeader` to false.
97+
</C.Property>
98+
<C.Property @name="hasStickyHeader" @type="boolean">
99+
Determines if the Advanced Table has a sticky header. If set to `true`, must be used with the `@maxHeight` argument. If `@maxHeight` is set and `@hasStickyHeader` is `false`, there will not be a sticky header.
97100
</C.Property>
98101
<C.Property @name="hasStickyFirstColumn" @type="boolean" @default="false">
99102
Determines if the Advanced Table has a sticky first column.

website/docs/components/table/advanced-table/partials/code/how-to-use.md

Lines changed: 49 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -382,31 +382,30 @@ We recommend using functionalities like [pagination](/components/pagination), [s
382382

383383
#### Vertical scrolling
384384

385-
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.
385+
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 `maxHeight` argument can be used to set the maximum height of the Advanced Table which will also add a sticky header. This will make the column headers persist as the user scrolls.
386+
387+
If you want to set the `maxHeight` but not have a sticky header, set `hasStickyHeader` to false.
386388

387389
```handlebars
388-
<!-- this is an element with "height: 500px" -->
389-
<div class="doc-advanced-table-vertical-scrollable-wrapper">
390-
<Hds::AdvancedTable
391-
@model={{this.demoDataWithLargeNumberOfRows}}
392-
@columns={{array
393-
(hash key="id" label="ID")
394-
(hash key="name" label="Name" isSortable=true)
395-
(hash key="email" label="Email")
396-
(hash key="role" label="Role" isSortable=true)
397-
}}
398-
@hasStickyHeader={{true}}
399-
>
400-
<:body as |B|>
401-
<B.Tr>
402-
<B.Td>{{B.data.id}}</B.Td>
403-
<B.Td>{{B.data.name}}</B.Td>
404-
<B.Td>{{B.data.email}}</B.Td>
405-
<B.Td>{{B.data.role}}</B.Td>
406-
</B.Tr>
407-
</:body>
408-
</Hds::AdvancedTable>
409-
</div>
390+
<Hds::AdvancedTable
391+
@model={{this.demoDataWithLargeNumberOfRows}}
392+
@columns={{array
393+
(hash key="id" label="ID")
394+
(hash key="name" label="Name" isSortable=true)
395+
(hash key="email" label="Email")
396+
(hash key="role" label="Role" isSortable=true)
397+
}}
398+
@maxHeight="500px"
399+
>
400+
<:body as |B|>
401+
<B.Tr>
402+
<B.Td>{{B.data.id}}</B.Td>
403+
<B.Td>{{B.data.name}}</B.Td>
404+
<B.Td>{{B.data.email}}</B.Td>
405+
<B.Td>{{B.data.role}}</B.Td>
406+
</B.Tr>
407+
</:body>
408+
</Hds::AdvancedTable>
410409
```
411410

412411
#### Horizontal scrolling
@@ -418,36 +417,33 @@ The component adds the sticky styles to the `[B].Th` component in each row. If t
418417
Note: Using `@hasStickyFirstColumn` with nested rows is not supported.
419418

420419
```handlebars
421-
<!-- this is an element with "overflow: auto" -->
422-
<div class="doc-advanced-table-scrollable-wrapper">
423-
<Hds::AdvancedTable
424-
@hasStickyFirstColumn={{true}}
425-
@model={{this.demoDataWithLargeNumberOfColumns}}
426-
@columns={{array
427-
(hash key="first_name" label="First Name" isSortable=true)
428-
(hash key="last_name" label="Last Name" isSortable=true)
429-
(hash key="age" label="Age" isSortable=true)
430-
(hash key="email" label="Email")
431-
(hash key="phone" label="Phone")
432-
(hash key="bio" label="Biography" width="350px")
433-
(hash key="education" label="Education Degree")
434-
(hash key="occupation" label="Occupation")
435-
}}
436-
>
437-
<:body as |B|>
438-
<B.Tr>
439-
<B.Th>{{B.data.first_name}}</B.Th>
440-
<B.Td>{{B.data.last_name}}</B.Td>
441-
<B.Td>{{B.data.age}}</B.Td>
442-
<B.Td>{{B.data.email}}</B.Td>
443-
<B.Td>{{B.data.phone}}</B.Td>
444-
<B.Td>{{B.data.bio}}</B.Td>
445-
<B.Td>{{B.data.education}}</B.Td>
446-
<B.Td>{{B.data.occupation}}</B.Td>
447-
</B.Tr>
448-
</:body>
449-
</Hds::AdvancedTable>
450-
</div>
420+
<Hds::AdvancedTable
421+
@hasStickyFirstColumn={{true}}
422+
@model={{this.demoDataWithLargeNumberOfColumns}}
423+
@columns={{array
424+
(hash key="first_name" label="First Name" isSortable=true)
425+
(hash key="last_name" label="Last Name" isSortable=true)
426+
(hash key="age" label="Age" isSortable=true)
427+
(hash key="email" label="Email")
428+
(hash key="phone" label="Phone")
429+
(hash key="bio" label="Biography" width="350px")
430+
(hash key="education" label="Education Degree")
431+
(hash key="occupation" label="Occupation")
432+
}}
433+
>
434+
<:body as |B|>
435+
<B.Tr>
436+
<B.Th>{{B.data.first_name}}</B.Th>
437+
<B.Td>{{B.data.last_name}}</B.Td>
438+
<B.Td>{{B.data.age}}</B.Td>
439+
<B.Td>{{B.data.email}}</B.Td>
440+
<B.Td>{{B.data.phone}}</B.Td>
441+
<B.Td>{{B.data.bio}}</B.Td>
442+
<B.Td>{{B.data.education}}</B.Td>
443+
<B.Td>{{B.data.occupation}}</B.Td>
444+
</B.Tr>
445+
</:body>
446+
</Hds::AdvancedTable>
451447
```
452448

453449
### Multi-select Advanced Table

0 commit comments

Comments
 (0)