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
@@ -40,41 +40,171 @@ FlexRender supports any type of content supported by Angular:
40
40
- A [TemplateRef](https://angular.dev/api/core/TemplateRef)
41
41
- A [Component](https://angular.dev/api/core/Component) wrapped into `FlexRenderComponent`
42
42
43
-
Example:
43
+
You can just use the `cell.renderValue` or `cell.getValue` APIs to render the cells of your table. However,
44
+
these APIs will only spit out the raw cell values (from accessor functions).
45
+
If you are using the `cell: () => any` column definition options, you will want to use the `FlexRenderDirective` from the adapter.
46
+
47
+
Cell column definition is **reactive** and runs into an **injection context**, then you can inject services or make use of signals to automatically modify the rendered content.
48
+
49
+
#### Example
44
50
45
51
```ts
46
52
@Component({
47
53
imports: [FlexRenderDirective],
48
54
//...
49
55
})
56
+
classYourComponent {}
50
57
```
51
58
52
59
```angular-html
53
60
54
61
<tbody>
55
62
@for (row of table.getRowModel().rows; track row.id) {
56
-
<tr>
57
-
@for (cell of row.getVisibleCells(); track cell.id) {
58
-
<td>
59
-
<ng-container
60
-
*flexRender="
63
+
<tr>
64
+
@for (cell of row.getVisibleCells(); track cell.id) {
65
+
<td>
66
+
<ng-container
67
+
*flexRender="
61
68
cell.column.columnDef.cell;
62
69
props: cell.getContext();
63
70
let cell
64
71
"
65
-
>
66
-
<!-- if you want to render a simple string -->
67
-
{{ cell }}
68
-
<!-- if you want to render an html string -->
69
-
<div [innerHTML]="cell"></div>
70
-
</ng-container>
71
-
</td>
72
-
}
73
-
</tr>
72
+
>
73
+
<!-- if you want to render a simple string -->
74
+
{{ cell }}
75
+
<!-- if you want to render an html string -->
76
+
<div [innerHTML]="cell"></div>
77
+
</ng-container>
78
+
</td>
79
+
}
80
+
</tr>
74
81
}
75
82
</tbody>
76
83
```
77
84
85
+
#### Rendering a Component
86
+
87
+
To render a Component into a specific column header/cell/footer, you can pass a `FlexRenderComponent` instantiated with
88
+
your `ComponentType, with the ability to include parameters such as inputs and an injector.
0 commit comments