Skip to content

Commit 7f187cf

Browse files
rk-menonVesaJuvonen
authored andcommitted
TileProps documentation (SharePoint#4529)
* Added documentation for more supported functions such as pow, subString * Added documentation around formatting tile layout * Formatting tile layout - moved images * Added documentation around tileProps * tileProps documentation update - removed HEAD text * Reduced size of image * Reduced size of image * Reduced size of image * Fixed typo * Fixed typo * Fixed typo
1 parent b3b2b25 commit 7f187cf

File tree

3 files changed

+122
-6
lines changed

3 files changed

+122
-6
lines changed

docs/declarative-customization/view-formatting.md

Lines changed: 122 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Use view formatting to customize SharePoint
33
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
55
localization_priority: Priority
66
---
77

@@ -15,10 +15,15 @@ You can use view formatting to customize how views in SharePoint lists and libra
1515
>[!NOTE]
1616
> View formatting is currently supported only in SharePoint Online.
1717
18-
1918
## Get started with view formatting
2019

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**. <img src="../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+
2227

2328
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).
2429

@@ -134,6 +139,108 @@ This example uses the `rowFormatter` element, which totally overrides the render
134139
```
135140
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)
136141

142+
143+
Similarly, to get the below format in ‘Tile’ layout for the Feedback list, define the formatter within `tileProps`:
144+
![Feedback list formatted in Tile layout](../images/feedback-tile-layout.png)
145+
146+
```JSON
147+
{
148+
"schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json",
149+
"tileProps": {
150+
"height": "250",
151+
"width": "350",
152+
"hideSelection": true,
153+
"formatter": {
154+
"elmType": "div",
155+
"style": {
156+
"display": "flex",
157+
"align-items": "stretch",
158+
"margin-bottom": "16px",
159+
"min-width": "150px",
160+
"flex-grow": "1",
161+
"justify-content": "space-around",
162+
"padding": "5px"
163+
},
164+
"children": [
165+
{
166+
"elmType": "div",
167+
"style": {
168+
"width": "95%",
169+
"height": "92%",
170+
"box-shadow": "0px 1.6px 3.6px 0 #00000024, 0px 0.3px 0.9px 0 #00000024",
171+
"overflow": "hidden",
172+
"border-radius": "2px",
173+
"padding-left": "16px",
174+
"padding-top": "16px"
175+
},
176+
"attributes": {
177+
"class": "ms-bgColor-neutralLighterAlt"
178+
},
179+
"children": [
180+
{
181+
"elmType": "div",
182+
"style": {
183+
"text-align": "left"
184+
},
185+
"children": [
186+
{
187+
"elmType": "div",
188+
"style": {
189+
"color":"#333333",
190+
"font-size": "16px",
191+
"font-weight":"600",
192+
"margin-bottom":"5px"
193+
},
194+
"txtContent": "[$Title]"
195+
},
196+
{
197+
"elmType": "div",
198+
"style": {
199+
"color":"#333333",
200+
"font-size": "14px",
201+
"line-height":"1.8"
202+
},
203+
"attributes": {
204+
"class": "sp-row-listPadding"
205+
},
206+
"txtContent": "[$Feedback]"
207+
},
208+
{
209+
"elmType": "button",
210+
"customRowAction": {
211+
"action": "defaultClick"
212+
},
213+
"txtContent": "Give feedback",
214+
"attributes": {
215+
"class": "sp-row-button"
216+
},
217+
"style": {
218+
"display": {
219+
"operator": "?",
220+
"operands": [
221+
{
222+
"operator": "==",
223+
"operands": [
224+
"@me",
225+
"[$Assigned_x0020_To.email]"
226+
]
227+
},
228+
"",
229+
"none"
230+
]
231+
}
232+
}
233+
}
234+
]
235+
}
236+
]
237+
}
238+
]
239+
}
240+
}
241+
}
242+
```
243+
137244
### Alternate Row Formatting based on Modulus
138245

139246
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
170277

171278
### rowFormatter
172279

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.
174281

175282
>[!NOTE]
176283
> 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
183290

184291
### additionalRowClass
185292

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.
187294

188295
`additionalRowClass` only takes effect when there is no `rowFormatter` element specified. If a `rowFormatter` is specified, then `additionalRowClass` is ignored.
189296

190297
### hideSelection
191298

192299
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.
193300

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.
195302

196303
### hideColumnHeader
197304

198305
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).
314+

docs/images/feedback-tile-layout.png

90 KB
Loading

docs/images/view-dropdown-menu.png

32.4 KB
Loading

0 commit comments

Comments
 (0)