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
6 changes: 6 additions & 0 deletions data/structures/table.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ arguments:
release: v0.24.13
filter:
filter-col:
justify:
comment: >-
Horizontal alignment of the filter controls. Requires `filter`, which is
the only element this argument positions — the table itself always spans
the full width of its container.
release: v3.18.0
wrap:
wrapper:
release: v2.0.0
Expand Down
12 changes: 12 additions & 0 deletions exampleSite/content/en/table-demo.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,18 @@ modules: ["simple-datatables"]
| delta | gadget | The fourth record, whose description runs on for a little while. |
{{< /table >}}

## Centered filter controls

{{< table filter="widget, gadget" filter-col="1" justify="center" class="fixture-filter-center" >}}

| Name | Type | Description |
|---------|--------|--------------------------------------------------------------------|
| alpha | widget | The first record, with a description long enough to need wrapping. |
| bravo | gadget | The second record, also with a fairly long trailing description. |
| charlie | widget | The third record. Short. |
| delta | gadget | The fourth record, whose description runs on for a little while. |
{{< /table >}}

## Filtered, sortable, wrapped data table

{{< table filter="widget,gadget" filter-col="1" sortable="true" paginate="true" pagination="2" wrap="true" class="fixture-filter-wrap" >}}
Expand Down
5 changes: 4 additions & 1 deletion layouts/_partials/assets/table.html
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,11 @@

{{ $wrapper := $args.wrapper | default "" }}

{{/* The controls sit in their own flex row, so they align independently of the table below —
which always spans the full width of its container. `justify` carries a default of
`start` in mod-utils, preserving the original alignment for every existing caller. */}}
{{ if $filter }}
<div class="table-filter-controls d-flex justify-content-start mb-3">
<div class="table-filter-controls d-flex justify-content-{{ $args.justify }} mb-3">
<div class="btn-group" role="group" aria-label="{{ T "tableFilterLabel" | default "Filter" }}">
<button type="button"
class="btn btn-outline-primary active"
Expand Down
1 change: 1 addition & 0 deletions layouts/_shortcodes/table.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"searchable" $args.searchable
"filter" $args.filter
"filter-col" $args.filterCol
"justify" $args.justify
"wrap" $args.wrap
"wrapper" $args.wrapper
"caption" $args.caption
Expand Down