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: docs/declarative-customization/view-formatting.md
+81-6Lines changed: 81 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -30,8 +30,6 @@ The easiest way to use view formatting is to start from an example and edit it t
30
30
31
31
You can use view formatting to apply a class to a list view row, depending on the value of one or more fields in the row. These examples leave the content and structure of list view rows intact.
32
32
33
-
Any conditional formatting scenario
34
-
35
33
For a list of recommended classes to use inside view formats, please see the [Style Guidelines section](https://github.com/SharePoint/sp-dev-docs/blob/master/docs/declarative-customization/column-formatting.md#style-guidelines) in the [Column Formatting reference document.](https://github.com/SharePoint/sp-dev-docs/blob/master/docs/declarative-customization/column-formatting.md)
36
34
37
35
### Conditional formatting based on a date range
@@ -61,8 +59,6 @@ This example applies the class `sp-field-severity--severeWarning` to a list view
61
59
62
60
### Conditional formatting based on the value in a text or choice field
63
61
64
-
The following image shows a list view with conditional formatting applied based on the value inside a choice field:
65
-
66
62
This example was adopted from a column formatting example, [Conditional formatting based on the value in a text of choice field](https://github.com/ldemaris/sp-dev-docs/blob/patch-7/docs/declarative-customization/column-formatting.md#conditional-formatting-based-on-the-value-in-a-text-or-choice-field-advanced), with some important differences to apply the concept to list view rows. The column formatting example applies both an icon and a class to a column based on the value of `@currentField`. The `additionalRowClass` attribute in view formatting, however, only allows you to specify a class and not an icon. Additionally, since `@currentField` always resolves to the value of the Title field when referenced inside a view format, this sample refers to the `$Status` field directly to determine which class to apply to the row.
67
63
68
64
```JSON
@@ -147,7 +143,86 @@ This example was adopted from a column formatting example, [Conditional formatti
147
143
148
144
You can use view formatting to define a totally custom layout of field values inside a row.
149
145
150
-
### Multi-line view
146
+
### Multi-line view style
147
+
148
+
The following image shows a list with a custom multi-line view style applied:
149
+
150
+
This example uses the `rowFormatter` element, which is used to totally override the rendering of a list view row. The `rowFormatter` in this example creates e a bounding `<div />` for every list view row. Inside this bounding box for every row, the `$Title` and `$Feedback` fields are displayed on separate lines. Under those fields, a `button` element is displayed that, when clicked, does the same thing as clicking the list row in an uncustomized view, which is opening the property form for the item. This `button` is displayed conditionally, when the value of the `$Assigned_x0020_To` field (assumed to be a person/group field) matches the current signed-in user.
@@ -174,7 +249,7 @@ Creating custom view formatting JSON from scratch is simple if you understand th
174
249
175
250
### rowFormatter
176
251
177
-
Optional element. Specifies a JSON object that describes a view format. The schema of this JSON object is identical to the schema of a column format. For details on this schema and its capabilities, see the [Column Format detailex syntax reference.](https://github.com/SharePoint/sp-dev-docs/blob/master/docs/declarative-customization/column-formatting.md#detailed-syntax-reference)
252
+
Optional element. Specifies a JSON object that describes a list view row format. The schema of this JSON object is identical to the schema of a column format. For details on this schema and its capabilities, see the [Column Format detailex syntax reference.](https://github.com/SharePoint/sp-dev-docs/blob/master/docs/declarative-customization/column-formatting.md#detailed-syntax-reference)
178
253
179
254
#### Differences in behavior between the rowFormatter element and column formatting
0 commit comments