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
Column and View formatting documentation update (SharePoint#7387)
* Support indexOf and lastIndexOf for Arrays
* Support fillHorizontally for tiles
* Support p tag
* Allow SVG style attributes
* Allow dragable attribute
* Support AverateRating column
* Support Likes column
* Allow tel: protocol
* Support getUserImage operator
* More updates for getUserImage op
* Update date
Copy file name to clipboardExpand all lines: docs/declarative-customization/column-formatting.md
+25-7Lines changed: 25 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: Use column formatting to customize SharePoint
3
3
description: Customize how fields in SharePoint lists and libraries are displayed by constructing a JSON object that describes the elements that are displayed when a field is included in a list view, and the styles to be applied to those elements.
4
-
ms.date: 09/28/2021
4
+
ms.date: 10/08/2021
5
5
ms.localizationpriority: high
6
6
---
7
7
@@ -289,7 +289,9 @@ Here's the same sample from above, using the Excel-style expression syntax:
289
289
290
290
## Create clickable actions
291
291
292
-
You can use column formatting to provide hyperlinks that go to other webpages, or start custom functionality. This functionality is limited to static links that can be parameterized with values from fields in the list. You can't use column formatting to output links to protocols other than `http://`, `https://`, or `mailto:`.
292
+
You can use column formatting to provide hyperlinks that go to other webpages, or start custom functionality. This functionality is limited to static links that can be parameterized with values from fields in the list. You can't use column formatting to output links to protocols other than `http://`, `https://`, `mailto:` or `tel:`.
293
+
294
+
`tel:` protocol only allows digits, `*+#` special characters and `.-/()` visual separators.
293
295
294
296
### Turn field values into hyperlinks (basic)
295
297
@@ -683,7 +685,7 @@ This examples uses operator `loopIndex` to control the margins all rows but the
683
685
{
684
686
"elmType": "img",
685
687
"attributes": {
686
-
"src": "=[$person.picture]"
688
+
"src": "=getUserImage([$person.email], 'S')"
687
689
},
688
690
"style": {
689
691
"width": "3em",
@@ -797,7 +799,7 @@ Both the example uses defaultHoverField
@@ -936,6 +938,8 @@ The following column types support column formatting:
936
938
* Title (in Lists)
937
939
* Yes/No
938
940
* Managed Metadata
941
+
* Average Rating
942
+
* Likes
939
943
940
944
The following are currently **not** supported:
941
945
@@ -998,6 +1002,7 @@ Specifies the type of element to create. Valid elements include:
998
1002
- svg
999
1003
- path
1000
1004
- button
1005
+
- p
1001
1006
1002
1007
Any other value will result in an error.
1003
1008
@@ -1210,6 +1215,9 @@ An optional property that specifies style attributes to apply to the element spe
1210
1215
'text-wrap'
1211
1216
'word-break'
1212
1217
'word-wrap'
1218
+
1219
+
'stroke'
1220
+
'fill-opacity'
1213
1221
```
1214
1222
1215
1223
The following example shows the value of a style object. In this example, two style properties (`padding` and `background-color`) will be applied. The `padding` value is a hard-coded string value. The `background-color` value is an Expression that is evaluated to either red (`#ff0000`) or green (`#00ff00`) depending on whether the value of the current field (specified by `@currentField`) is less than 40. For more information, see the Expression object section.
@@ -1268,6 +1276,7 @@ An optional property that specifies additional attributes to add to the element
1268
1276
- data-interception
1269
1277
- viewBox
1270
1278
- preserveAspectRatio
1279
+
- draggable
1271
1280
1272
1281
Any other attribute name will result in an error. Attribute values can either be Expression objects or strings. The following example adds two attributes (`target` and `href`) to the element specified by `elmType`. The `target` attribute is hard-coded to a string. The `href` attribute is an expression that will be evaluated at runtime to http://finance.yahoo.com/quote/ + the value of the current field (`@currentField`).
1273
1282
@@ -1420,6 +1429,7 @@ Operators specify the type of operation to perform. The following operators are
1420
1429
- replace
1421
1430
- padStart
1422
1431
- padEnd
1432
+
- getUserImage
1423
1433
1424
1434
**Binary arithmetic operators** - The following are the standard arithmetic binary operators that expect two operands:
1425
1435
@@ -1496,20 +1506,20 @@ Operators specify the type of operation to perform. The following operators are
1496
1506
1497
1507
**Binary operators** - The following are operators that expect two operands:
1498
1508
1499
-
-**indexOf**: takes 2 operands. The first is the text you would like to search within, the second is the text you would like to search for. Returns the index value of the first occurrence of the search term within the string. Indexes start at 0. If the search term is not found within the text, -1 is returned. This operator is case-sensitive. - _Only available in SharePoint Online_
1509
+
-**indexOf**: takes 2 operands. The first is the text (or array) you would like to search within, the second is the text you would like to search for. Returns the index value of the first occurrence of the search term within the string (or array). Indexes start at 0. If the search term is not found within the text (or array), -1 is returned. This operator is case-sensitive. - _Only available in SharePoint Online_
1500
1510
-`"txtContent": "=indexOf('DogFood', 'Dog')"` results in _0_
1501
1511
-`"txtContent": "=indexOf('DogFood', 'F')"` results in _3_
1502
1512
-`"txtContent": "=indexOf('DogFood', 'Cat')"` results in _-1_
1503
1513
-`"txtContent": "=indexOf('DogFood', 'f')"` results in _-1_
1504
-
1514
+
1505
1515
-**join**: takes 2 operands. The first is an array (multi-select person or choice field) and the second is the separating string. Returns a string concatenation of the array values separated by the separating string. - _Only available in SharePoint Online_
1506
1516
-`"txtContent": "=join(@currentField, ', ')"` might result in _"Apple, Orange, Cherry"_ (depending on the selected values)
1507
1517
-`"txtContent": "=join(@currentField.title, '|')"` might result in _"Chris Kent|Vesa Juvonen|Jeff Teper"_ (depending on the selected persons)
1508
1518
1509
1519
-**pow**: returns the base to the exponent power. - _Only available in SharePoint Online_
1510
1520
-`"txtContent":"=pow(2,3)"` results in _8_
1511
1521
1512
-
-**lastIndexOf**: returns the position of the last occurrence of a specified value in a string
1522
+
-**lastIndexOf**: returns the position of the last occurrence of a specified value in a string (or array)
1513
1523
-`"txtContent": "=lastIndexOf('DogFood DogFood', 'Dog')"` results in _8_
1514
1524
-`"txtContent": "=lastIndexOf('DogFood DogFood', 'F')"` results in _11_
1515
1525
-`"txtContent": "=lastIndexOf('DogFood DogFood', 'Cat')"` results in _-1_
@@ -1523,6 +1533,14 @@ Operators specify the type of operation to perform. The following operators are
1523
1533
-`"txtContent":"=endsWith('DogFood', 'Dog')"` results in _false_
1524
1534
-`"txtContent":"=endsWith('DogFood', 'Food')"` results in _true_
1525
1535
1536
+
-**getUserImage**: returns a URL pointing to user's profile image for a given email and preferred size
1537
+
-`"src":"=getUserImage('[email protected]', 'small')"` returns a URL pointing to user's profile picture in small resolution
1538
+
-`"src":"=getUserImage('[email protected]', 's')"` returns a URL pointing to user's profile picture in small resolution
1539
+
-`"src":"=getUserImage('[email protected]', 'medium')"` returns a URL pointing to user's profile picture in medium resolution
1540
+
-`"src":"=getUserImage('[email protected]', 'm')"` returns a URL pointing to user's profile picture in medium resolution
1541
+
-`"src":"=getUserImage('[email protected]', 'large')"` returns a URL pointing to user's profile picture in large resolution
1542
+
-`"src":"=getUserImage('[email protected]', 'l')"` returns a URL pointing to user's profile picture in large resolution
1543
+
1526
1544
**Ternary operators** - The following are operators that expect three operands:
1527
1545
1528
1546
-**substring**: returns the part of the string between the start and end indices. - _Only available in SharePoint Online_
Copy file name to clipboardExpand all lines: docs/declarative-customization/view-formatting.md
+5-1Lines changed: 5 additions & 1 deletion
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: 09/14/2021
4
+
ms.date: 10/08/2021
5
5
ms.localizationpriority: high
6
6
---
7
7
@@ -821,6 +821,10 @@ Optional element. Specifies whether the ability to select rows in the view is di
821
821
822
822
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.
823
823
824
+
### fillHorizontally
825
+
826
+
Optional element. Specifies whether the cards in the row should be stretched horizontally to fill the row. `false` is the default behavior (meaning cards in a row are stacked without resizing until they overflow). `true` means cards in the row are stretched horizontally only if necessary to fill the row. Only valid for 'Gallery' layout.
827
+
824
828
### hideColumnHeader
825
829
826
830
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. Only valid for 'List' and 'Compact List' layouts.
0 commit comments