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
+102Lines changed: 102 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -242,3 +242,105 @@ The following image shows a list with a Gallery layout referencing the Category
242
242
}
243
243
}
244
244
```
245
+
## Inline Editing
246
+
247
+
With inline editing, formatters have the ability to load field editors to edit field data on an item.
248
+
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.
249
+
250
+
A special json property `inlineEditField` is used with value as the field internal name __`[$FieldName]`__ at the target element in the json.
251
+
252
+
```json
253
+
{
254
+
"elmType": "div",
255
+
"inlineEditField": "[$FieldName]",
256
+
"txtContent": "[$FieldName]"
257
+
}
258
+
```
259
+
260
+
<imgsrc="../images/sp-columnformatting-inline-editing.gif"alt="Inline Editing using inlineEditField property"/>
261
+
262
+
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.
263
+
264
+
### Supported Field Types
265
+
List of supported field types for inline editing
266
+
- Single line text
267
+
- Multi line text (without RTF)
268
+
- Number
269
+
- DateTime
270
+
- Choice and MultiChoice
271
+
- User and Multi user
272
+
- Lookup
273
+
274
+
### Hover Borders and Customizations
275
+
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`.
276
+
277
+
```json
278
+
{
279
+
"elmType": "div",
280
+
"inlineEditField": "[$FieldName]",
281
+
"txtContent": "[$FieldName]",
282
+
"style": {
283
+
"--inline-editor-border-color": "transparent transparent red transparent",
284
+
"border-color": "gray",
285
+
"border-width": "1px",
286
+
"border-style": "solid"
287
+
}
288
+
}
289
+
```
290
+
291
+
## Set multiple field values of an Item using customRowAction
292
+
293
+
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.
294
+
295
+
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-1Lines changed: 53 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -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.
@@ -325,7 +330,22 @@ The `actionParams` attribute can have the following options when using the `exec
325
330
-**id**: ID of the Flow to launch _(required)_
326
331
-**headerText**: Sets the text at the top of the flow panel _(optional)_
327
332
-**runFlowButtonText**: Sets the text of the primary button in the flow panel _(optional)_
328
-
-
333
+
334
+
-**setValue**: Clicking the element will update the item with the field values provided.
335
+
336
+
```JSON
337
+
{
338
+
"elmType": "div",
339
+
"txtContent": "[$FieldName]",
340
+
"customRowAction":{
341
+
"action": "setValue",
342
+
"actionInput": {
343
+
"FieldInternalName_1": "FieldValue_1",
344
+
"FieldInternalName_2": "FieldValue_2",
345
+
}
346
+
}
347
+
}
348
+
```
329
349
330
350
## customCardProps
331
351
@@ -353,6 +373,18 @@ This will be replaced with the referenced column's formatter JSON. Multi level r
353
373
}
354
374
```
355
375
376
+
## inlineEditField
377
+
378
+
Adds the field editor for the referenced column.
379
+
380
+
```JSON
381
+
{
382
+
"elmType": "div",
383
+
"inlineEditField": "[$FieldName]",
384
+
"txtContent": "[$FieldName]"
385
+
}
386
+
```
387
+
356
388
## Expressions
357
389
358
390
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 +505,10 @@ Operators specify the type of operation to perform. The following operators are
473
505
- padStart
474
506
- padEnd
475
507
- getUserImage
508
+
- addDays
509
+
- addMinutes
510
+
- appendTo
511
+
- removeFrom
476
512
477
513
**Binary arithmetic operators** - The following are the standard arithmetic binary operators that expect two operands:
478
514
@@ -584,6 +620,22 @@ Operators specify the type of operation to perform. The following operators are
584
620
-`"src":"=getUserImage('[email protected]', 'large')"` returns a URL pointing to user's profile picture in large resolution
585
621
-`"src":"=getUserImage('[email protected]', 'l')"` returns a URL pointing to user's profile picture in large resolution
586
622
623
+
-**appendTo**: returns an array with the given entry appended to the given array
624
+
-`"txtContent": "=appendTo(@currentField, 'Choice 4')"` returns an array with 'Choice 4' added to the @currentField array
625
+
-`"txtContent": "=appendTo(@currentField, '[email protected]')"` returns an array with '[email protected]' added to the @currentField array
626
+
627
+
-**removeFrom**: returns an array with the given entry removed from the given array, if present
628
+
-`"txtContent": "=removeFrom(@currentField, 'Choice 4')"` returns an array with 'Choice 4' removed from the @currentField array
629
+
-`"txtContent": "=removeFrom(@currentField, '[email protected]')"` returns an array with '[email protected]' removed from the @currentField array
630
+
631
+
-**addDays**: returns a datetime object with days added (or deducted) from the given datetime value
632
+
-`"txtContent": "=addDays(Date('11/14/2021'), 3)"` returns a 11/17/2021, 12:00:00 AM
633
+
-`"txtContent": "=addDays(Date('11/14/2021'), -1)"` returns a 11/13/2021, 12:00:00 AM
634
+
635
+
-**addMinutes**: returns a datetime object with minutes added (or deducted) from the given datetime value
636
+
-`"txtContent": "=addMinutes(Date('11/14/2021'), 3)"` returns a 11/14/2021, 12:03:00 AM
637
+
-`"txtContent": "=addMinutes(Date('11/14/2021'), -1)"` returns a 11/13/2021, 11:59:00 AM
638
+
587
639
**Ternary operators** - The following are operators that expect three operands:
588
640
589
641
-**substring**: returns the part of the string between the start and end indices. - _Only available in SharePoint Online_
0 commit comments