Apr 21 2022 02:13 AM
Hallo zusammen,
ich habe eine Frage zur Erstellung einer Liste in SharePoint bzw. der Formatierung einer Zeile. Eine Spalte in meiner Liste beinhaltet die Kategorie "Status". Also die Auswahlmöglichkeit zwischen Aktiv und Inaktiv. Ich möchte die Zeile so konfigurieren, dass bei der Auswahl "Inaktiv" die komplette Zeile z.B. grau hinterlegt wird. Sodass alle Zeilen mit dem Status "Inaktiv" grau sind und sich so farblich von den "Aktiven" Zeilen unterscheiden.
Bei dieser Einstellung hinterlegt er lediglich nur das Wort "Inaktiv" mit der Farbe grau und nicht die ganze Zeile.
{
"elmType": "div",
"style": {
"box-sizing": "border-box",
"padding": "0 2px",
"overflow": "hidden",
"text-overflow": "ellipsis"
},
"attributes": {
"class": {
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
"[$Status2]",
"Inaktiv"
]
},
"sp-css-backgroundColor-BgLightGray sp-field-fontSizeSmall sp-css-color-LightGrayFont",
""
]
}
},
"txtContent": "[$Status2]"
}
Außerdem besteht die Möglichkeit die Zeilenbreite zu konfigurieren? Die Spaltenbreite kann man ohne Probleme vergrößern, jedoch würde ich gerne die Zeilenbreite auch erweitern?
Ich hoffe, dass es eine Lösung gibt. Vielen Dank
Apr 21 2022 02:18 AM
Apr 21 2022 05:28 AM
@LukasPepunkt using JSON formatting you can certainly make the text or backgound color grey if the status is inactive, but you can't make it non-editable. Anyone who can edit the list will still be able to edit the item.
Rob
Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)
Apr 21 2022 05:34 AM
@RobElliott Thank you for your help, but thats not my question. If the status is "inactive" with background color grey, then its only the word backgrounded. But i want that then the complete row is grey backgrounded.
Apr 21 2022 05:41 AM - edited Apr 21 2022 05:41 AM
Maybe I did not express myself correctly. 1. make a list 2. choose "selection" as a option for my list 3. choice 1: active / choice 2: inactive
And now i want every row where the option "inactive" has been selected to have the row grayed out. Not only the word "inactive"
Apr 21 2022 10:48 AM
Solution@LukasPepunkt oh right, you can do that by formatting the current view with the following JSON:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/row-formatting.schema.json",
"additionalRowClass": {
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
"[$Status]",
"Inactive"
]
},
"sp-css-backgroundColor-BgLightGray sp-css-color-LightGrayFont",
""
]
}
}
In my case I greyed it out when the Status column = Cancelled
Rob
Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)
Apr 25 2022 12:36 AM
@RobElliottThank you! It works now except for one thing. If you select "Inaktiv" (inactive), the line now has a gray background. But the word "Inaktiv" is no longer displayed or which status i have selected.
And i hope you can find my second mistake, because JSON is telling me thats not correct. After each row there should be a line for division. However, this does not work for me in advanced mode. How should be the JSON if i want to combine both ("inactive row backgrounded grey" and "after each row line for div. )
Hope you can help me again! Best regards Lukas@RobElliott
Apr 25 2022 04:10 AM
Apr 21 2022 10:48 AM
Solution@LukasPepunkt oh right, you can do that by formatting the current view with the following JSON:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/row-formatting.schema.json",
"additionalRowClass": {
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
"[$Status]",
"Inactive"
]
},
"sp-css-backgroundColor-BgLightGray sp-css-color-LightGrayFont",
""
]
}
}
In my case I greyed it out when the Status column = Cancelled
Rob
Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)