Skip to content

Commit e5c8c99

Browse files
niketjain2020VesaJuvonen
authored andcommitted
DocChanges Modulus and Images (SharePoint#3569)
* DocChanges Modulus and Images * Updates * Updates * Updates * Updates * Updates * Updates
1 parent f271155 commit e5c8c99

File tree

6 files changed

+44
-3
lines changed

6 files changed

+44
-3
lines changed

docs/declarative-customization/column-formatting.md

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1283,8 +1283,8 @@ The people field object has the following properties (with example values):
12831283
"title": "Kalya Tucker",
12841284
"email": "[email protected]",
12851285
1286-
"picture": "https://contoso.sharepoint.com/kaylat_contoso_com_MThumb.jpg?t=63576928822",
1287-
"department":"Human Resources",
1286+
"picture": "https://contoso.sharepoint.com/kaylat_contoso_com_MThumb.jpg?t=63576928822",
1287+
"department":"Human Resources",
12881288
"jobTitle":"HR Manager"
12891289
}
12901290
```
@@ -1456,6 +1456,37 @@ This will evaluate to a number equal to the height of the browser window (in pix
14561456

14571457
This will evaluate to a number equal to the width of the browser window (in pixels) when the list was rendered.
14581458

1459+
#### Thumbnails
1460+
1461+
In a document library, there is a series of tokens that can be used to retrieve the URL to the thumbnail of a file, including:
1462+
1463+
- `@thumbnail.small`, `@thumbnail.medium`, and `@thumbnail.large` evaluate to the thumbnail URL in 3 different predefined sizes.
1464+
- `@thumbnail.<bounding size>` evaluates to the URL to the largest thumbnails that is not larger than the bounding size in both width and height. For example, `@thumbnail.150` evaluates to the URL to a thumbnail not larger than 150×150 pixels.
1465+
- `@thumbnail.<bounding width>x<bounding height>` evaluates to the URL to the largest thumbnail that is not larger than the bounding width and bounding height. For example, `@thumbnail.100x200` evaluates to the URL to a thumbnail not wider than 100 pixels and not higher than 200 pixels.
1466+
1467+
These tokens will yield no value on non-file items including folders.
1468+
1469+
> [!NOTE]
1470+
> The aspect ratio of thumbnail generated is the same as how the file looks like, changing the bounding sizes will not affect the aspect ratio of the thumbnail.
1471+
1472+
> [!TIP]
1473+
> Thumbnails are only available for a list of supported file formats. It means that sometimes the URL generated is not accessible due to lack of support on certain formats. However, if a valid thumbnail token is set as the _only_ `src` attribute of an `img` tag, we will take care of it and hide the image when it is not available.
1474+
1475+
```json
1476+
{
1477+
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
1478+
"elmType": "img",
1479+
"attributes": {
1480+
"src": "@thumbnail.200x150",
1481+
"alt": "='Thumbnail of file ' + [$FileLeafRef]"
1482+
},
1483+
"style": {
1484+
"width": "100%",
1485+
"max-width": "100%"
1486+
}
1487+
}
1488+
```
1489+
14591490
## See also
14601491

14611492
- [Column formatting](https://support.office.com/en-us/article/Column-formatting-1f927342-2bed-4745-b727-ff8b7ff96b22?ui=en-US&rs=en-US&ad=US)

docs/declarative-customization/view-formatting.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,19 @@ This example uses the `rowFormatter` element, which totally overrides the render
128128
}
129129
}
130130
```
131-
132131
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)
133132

133+
### Alternate Row Formatting based on Modulus
134+
135+
This example applies `% (Mod)` to a list view row with alternate coloring the rows:
136+
137+
```JSON
138+
{
139+
"schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json",
140+
"additionalRowClass": "=if(@rowIndex%2==0,'ms-bgColor-themeLight','')"
141+
}
142+
```
143+
134144
## Creating custom JSON
135145

136146
Creating custom view formatting JSON from scratch is simple if you understand the schema. To create your own custom column formatting:

docs/images/Alternate-Rows.png

5.12 KB
Loading
Loading
Loading
Loading

0 commit comments

Comments
 (0)