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/formatting-advanced.md
+103Lines changed: 103 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -254,3 +254,106 @@ The following image shows a list with a Gallery layout referencing the Category
254
254
}
255
255
}
256
256
```
257
+
## Inline Editing
258
+
259
+
With inline editing, formatters have the ability to load field editors to edit field data on an item.
260
+
Users need to have edit permissions on the list item and the field type should belong to set of supported types for this feature to work.
261
+
262
+
A special json property `inlineEditField` is used with value as the field internal name __`[$FieldName]`__ at the target element in the json.
263
+
264
+
```json
265
+
{
266
+
"elmType": "div",
267
+
"inlineEditField": "[$FieldName]",
268
+
"txtContent": "[$FieldName]"
269
+
}
270
+
```
271
+
<br />
272
+
273
+

274
+
275
+
This allows the users to edit items in-place, within the view, without navigating away to grid based editing or to a item edit form.
276
+
277
+
### Supported Field Types
278
+
List of supported field types for inline editing
279
+
- Single line text
280
+
- Multi line text (without RTF)
281
+
- Number
282
+
- DateTime
283
+
- Choice and MultiChoice
284
+
- User and Multi user
285
+
- Lookup
286
+
287
+
### Hover Borders and Customizations
288
+
The inline editing adds a hover border on the elements to indicate these elements have an associated action. The default border is `neutralSecondary` , and on click, the editor appears with a `themePrimary` border. These border colors can be overriden via setting style on the same element with `inlineEditField` by using some special attributes - `--inline-editor-border-width`, `--inline-editor-border-style`, `--inline-editor-border-radius` and `--inline-editor-border-color`.
289
+
290
+
```json
291
+
{
292
+
"elmType": "div",
293
+
"inlineEditField": "[$FieldName]",
294
+
"txtContent": "[$FieldName]",
295
+
"style": {
296
+
"--inline-editor-border-color": "transparent transparent red transparent",
297
+
"border-color": "gray",
298
+
"border-width": "1px",
299
+
"border-style": "solid"
300
+
}
301
+
}
302
+
```
303
+
304
+
## Set multiple field values of an Item using customRowAction
305
+
306
+
With the new `setValue``customRowAction`, formatters can render action buttons which modify the item internally without opening editors or forms. `setValue` also allows setting multiple field values of the item at once.
307
+
308
+
The below JSON will set value of `FieldInternalName_1`, `FieldInternalName_2` and `FieldInternalName_3`with the values provided.
Copy file name to clipboardExpand all lines: docs/declarative-customization/formatting-syntax-reference.md
+53-2Lines changed: 53 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: Formatting syntax reference
3
3
description: Formatting syntax reference
4
-
ms.date: 11/11/2021
4
+
ms.date: 11/16/2021
5
5
ms.localizationpriority: high
6
6
---
7
7
@@ -180,6 +180,11 @@ An optional property that specifies style attributes to apply to the element spe
180
180
181
181
'stroke'
182
182
'fill-opacity'
183
+
184
+
'--inline-editor-border-width'
185
+
'--inline-editor-border-style'
186
+
'--inline-editor-border-radius'
187
+
'--inline-editor-border-color'
183
188
```
184
189
185
190
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.
@@ -307,6 +312,21 @@ See [here](./column-formatting.md#formatting-multi-value-fields) for examples.
307
312
-**delete**: Clicking the button will open the delete confirmation dialog.
308
313
-**editProps**: Clicking the button will open the item properties page in edit mode.
309
314
-**openContextMenu**: Clicking the button will open the item's default context menu.
315
+
-**setValue**: Clicking the element will update the item with the field values provided.
316
+
317
+
```JSON
318
+
{
319
+
"elmType": "div",
320
+
"txtContent": "[$FieldName]",
321
+
"customRowAction":{
322
+
"action": "setValue",
323
+
"actionInput": {
324
+
"FieldInternalName_1": "FieldValue_1",
325
+
"FieldInternalName_2": "FieldValue_2",
326
+
}
327
+
}
328
+
}
329
+
```
310
330
-**executeFlow**: Clicking the button will launch the specified Flow, specified by ID inside the `actionParams` attribute. For an example of this, see [Create a button to launch a Flow](./formatting-advanced.md#create-a-button-to-launch-a-flow). Below is an example of this type of button.
311
331
312
332
```JSON
@@ -325,7 +345,6 @@ The `actionParams` attribute can have the following options when using the `exec
325
345
-**id**: ID of the Flow to launch _(required)_
326
346
-**headerText**: Sets the text at the top of the flow panel _(optional)_
327
347
-**runFlowButtonText**: Sets the text of the primary button in the flow panel _(optional)_
328
-
-
329
348
330
349
## customCardProps
331
350
@@ -353,6 +372,18 @@ This will be replaced with the referenced column's formatter JSON. Multi level r
353
372
}
354
373
```
355
374
375
+
## inlineEditField
376
+
377
+
Adds the field editor for the referenced column.
378
+
379
+
```JSON
380
+
{
381
+
"elmType": "div",
382
+
"inlineEditField": "[$FieldName]",
383
+
"txtContent": "[$FieldName]"
384
+
}
385
+
```
386
+
356
387
## Expressions
357
388
358
389
Values for `txtContent`, style properties, and attribute properties can be expressed as expressions, so that they are evaluated at runtime based on the context of the current field (or row). Expression objects can be nested to contain other Expression objects.
@@ -473,6 +504,10 @@ Operators specify the type of operation to perform. The following operators are
473
504
- padStart
474
505
- padEnd
475
506
- getUserImage
507
+
- addDays
508
+
- addMinutes
509
+
- appendTo
510
+
- removeFrom
476
511
477
512
**Binary arithmetic operators** - The following are the standard arithmetic binary operators that expect two operands:
478
513
@@ -584,6 +619,22 @@ Operators specify the type of operation to perform. The following operators are
584
619
-`"src":"=getUserImage('[email protected]', 'large')"` returns a URL pointing to user's profile picture in large resolution
585
620
-`"src":"=getUserImage('[email protected]', 'l')"` returns a URL pointing to user's profile picture in large resolution
586
621
622
+
-**appendTo**: returns an array with the given entry appended to the given array
623
+
-`"txtContent": "=appendTo(@currentField, 'Choice 4')"` returns an array with 'Choice 4' added to the @currentField array
624
+
-`"txtContent": "=appendTo(@currentField, '[email protected]')"` returns an array with '[email protected]' added to the @currentField array
625
+
626
+
-**removeFrom**: returns an array with the given entry removed from the given array, if present
627
+
-`"txtContent": "=removeFrom(@currentField, 'Choice 4')"` returns an array with 'Choice 4' removed from the @currentField array
628
+
-`"txtContent": "=removeFrom(@currentField, '[email protected]')"` returns an array with '[email protected]' removed from the @currentField array
629
+
630
+
-**addDays**: returns a datetime object with days added (or deducted) from the given datetime value
631
+
-`"txtContent": "=addDays(Date('11/14/2021'), 3)"` returns a 11/17/2021, 12:00:00 AM
632
+
-`"txtContent": "=addDays(Date('11/14/2021'), -1)"` returns a 11/13/2021, 12:00:00 AM
633
+
634
+
-**addMinutes**: returns a datetime object with minutes added (or deducted) from the given datetime value
635
+
-`"txtContent": "=addMinutes(Date('11/14/2021'), 3)"` returns a 11/14/2021, 12:03:00 AM
636
+
-`"txtContent": "=addMinutes(Date('11/14/2021'), -1)"` returns a 11/13/2021, 11:59:00 AM
637
+
587
638
**Ternary operators** - The following are operators that expect three operands:
588
639
589
640
-**substring**: returns the part of the string between the start and end indices. - _Only available in SharePoint Online_
0 commit comments