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: README.md
+21-3Lines changed: 21 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -108,7 +108,7 @@ For example:
108
108
109
109
```css
110
110
.restrict-height {
111
-
height: 400px;
111
+
height: 500px;
112
112
}
113
113
```
114
114
@@ -250,7 +250,11 @@ For example, here we have two regular columns and a third "profile" column that
250
250
]
251
251
```
252
252
253
-
Custom cell components will automatically be provided with two properties: `columnDef` and `dataRow`. These properties are exactly what they sound like -- the column definition and data row for the cell, respectively.
253
+
Custom cell components will automatically be provided with three properties:
254
+
255
+
* `columnDef` - the column definition
256
+
* `dataRow` - the object from the `content` array represented by this row
257
+
* `rowExpanded` - a boolean value indicating whether or not the row is expanded (more on this in the [Row Expansion](#row-expansion) section below)
254
258
255
259
For example, the Handlebars markup for the example `link-to-profile` component could look like this:
256
260
```handlebars
@@ -577,7 +581,21 @@ Consumers should keep track of which rows are selected by subscribing to `onSele
577
581
578
582
### Row Clicking
579
583
For simple row click interaction without showing the row checkbox `onRowClick` should be bound to an action on the owning controller or component. The bound action will be called whenever the row is clicked. It receives the following parameter:
580
-
* `clickedRow` (Object) the data object for the row that was clicked.
584
+
* `clickedRow` (Object) the data object for the row that was clicked.
585
+
586
+
### Row Expansion
587
+
588
+
Fixtable has built-in support for expandable rows, for cases where you may desire to show more information than can comfortably fit on a single row. When a row is "expanded," a second, full-width table row is displayed beneath the normal row. In this expanded space, Fixtable will render whatever custom component you specify in the `expandedRowComponent` property. This component will receive the same `dataRow` binding as any custom cell component in the main row (see [Custom Cell Components](#custom-cell-components) above).
589
+
590
+
To allow for toggling rows between expanded and collapsed state, you should include a component in one of your column definitions that toggles the `rowExpanded` property. Fixtable includes a simple component, `fixtable-row-toggle`, that you can use for this purpose. You can also make a custom component if you need additional logic or prefer a different design. It's also noteworthy that any custom cell component can read and write the `rowExpanded` property, so you can toggle or react to this value in multiple columns if needed.
591
+
592
+
Because "expanded" rows are actually rendered as two table rows, Fixtable takes some steps to ensure you can still style them as desired. For one thing, any border between the two rows will be removed by default to maintain the illusion of a single row (this can, naturally, be overridden in your own CSS). Fixtable also applies some helpful CSS classes to each row element:
593
+
594
+
* `fixtable-row-primary` - the primary, multi-column row (rendered from your column definition)
595
+
* `fixtable-row-secondary` - the second, full-width column that renders your `expandedRowComponent`
596
+
* `expanded` - present on both row elements when the dataRow is expanded
597
+
* `hover` - present on both row elements when the user's cursor is hovering over _either_ row element (you should use this class rather than relying on the `:hover` pseudo-class if you want to use hover styles with expanded rows)
598
+
* `active` - present on both row elements if the row is selected (see [Row Selection](#row-selection) above)
0 commit comments