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
+122-6Lines changed: 122 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: Use view formatting to customize SharePoint
3
3
description: Customize how views in SharePoint lists and libraries are displayed by constructing a JSON object that describes the elements that are displayed in a list view, and the styles to be applied to those elements.
4
-
ms.date: 08/21/2019
4
+
ms.date: 08/23/2019
5
5
localization_priority: Priority
6
6
---
7
7
@@ -15,10 +15,15 @@ You can use view formatting to customize how views in SharePoint lists and libra
15
15
>[!NOTE]
16
16
> View formatting is currently supported only in SharePoint Online.
17
17
18
-
19
18
## Get started with view formatting
20
19
21
-
To open the view formatting pane, open the view dropdown and choose **Format this view**.
20
+
To open the view formatting pane, open the view dropdown and choose **Format current view**. <imgsrc="../images/view-dropdown-menu.png"alt="View dropdown menu"width="260"height="310"/>
21
+
22
+
>[!NOTE]
23
+
> To enable the 'Tile' layout, include `tileProps` property inside the JSON.
24
+
25
+
To format rows in 'List' or 'Compact List' layout, use the `rowFormatter` or `additionalRowClass` properties. To format entries in 'Tile' layout, use the `formatter` within `tileProps` property.
26
+
22
27
23
28
The easiest way to use view formatting is to start from an example and edit it to apply to your specific view. The following sections contain examples that you can copy, paste, and customize for your specific needs. There are also several samples available in the [SharePoint/sp-dev-list-formatting repository](https://github.com/SharePoint/sp-dev-list-formatting).
24
29
@@ -134,6 +139,108 @@ This example uses the `rowFormatter` element, which totally overrides the render
134
139
```
135
140
You can find this sample with additional details here: [Multi-line view rendering](https://github.com/SharePoint/sp-dev-list-formatting/tree/master/view-samples/multi-line-view)
136
141
142
+
143
+
Similarly, to get the below format in ‘Tile’ layout for the Feedback list, define the formatter within `tileProps`:
144
+

This example applies `% (Mod)` to a list view row with alternate coloring the rows:
@@ -170,7 +277,7 @@ You now have validation and autocomplete to create your JSON. You can start addi
170
277
171
278
### rowFormatter
172
279
173
-
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 detailed syntax reference](https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/column-formatting#detailed-syntax-reference).
280
+
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 detailed syntax reference](https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/column-formatting#detailed-syntax-reference). Only valid for 'List' and 'Compact List' layouts.
174
281
175
282
>[!NOTE]
176
283
> Using the `rowFormatter` property will override anything specified in the `additionalRowClass` property. They are mutually exclusive.
@@ -183,16 +290,25 @@ Despite sharing the same schema, there are some differences in behavior between
183
290
184
291
### additionalRowClass
185
292
186
-
Optional element. Specifies a CSS class(es) that is applied to the entire row. Supports expressions.
293
+
Optional element. Specifies a CSS class(es) that is applied to the entire row. Supports expressions. Only valid for 'List' and 'Compact List' layouts.
187
294
188
295
`additionalRowClass` only takes effect when there is no `rowFormatter` element specified. If a `rowFormatter` is specified, then `additionalRowClass` is ignored.
189
296
190
297
### hideSelection
191
298
192
299
Optional element. Specifies whether the ability to select rows in the view is disabled or not. *false* is the default behavior inside a list view (meaning selection is visible and enabled). *true* means that users will not be able to select list items.
193
300
194
-
`hideSelection` only takes effect when there's a `rowFormatter` element specified. If no `rowFormatter` is specified, then `hideSelection` is ignored.
301
+
For list & compact list layout, `hideSelection` only takes effect when there's a `rowFormatter` element specified. If no `rowFormatter` is specified, then `hideSelection` is ignored. For 'Tile' layout, `hideSelection` will only take effect if defined inside `tileProps` properties.
195
302
196
303
### hideColumnHeader
197
304
198
305
Optional element. Specifies whether the column headers in the view are hidden or not. *false* is the default behavior inside a list view (meaning column headers will be visible). *true* means that the view will not display column headers.
306
+
307
+
### tileProps
308
+
309
+
Optional element. Specifies a JSON object that describes a 'Tile' view format. Elements of this property include:
310
+
- height – defines the height of the card in pixels.
311
+
- width – defines the width of the card in pixels. Can go from height/2 to 3 x height.
312
+
- hideSelection – as defined above
313
+
- formatter – JSON object that defines the layout of tiles. The schema of this JSON object is identical to the schema of a column format (and that of rowFormatter). For details on this schema and its capabilities, see the [Column Format detailed syntax reference](https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/column-formatting#detailed-syntax-reference).
0 commit comments