SOLVED

SharePoint - Konfigurieren des Listenformats - Zeile formatieren

Copper Contributor

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

7 Replies
Summary: I want to increase the line width of a list and is it possible to delimit the entire line in grey with a command? (if for example status "inactive" the line is grayed out)

@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)

@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. 

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"

best response confirmed by LukasPepunkt (Copper Contributor)
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

 

greyedOut.png

 

Rob
Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)

@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. )

 

Unbenannt.PNG

 

Hope you can help me again! Best regards Lukas@RobElliott

 

 

Okay i solved the problem "displayed status...". Just need help to combine the grey background and the splitted rows with a line.
1 best response

Accepted Solutions
best response confirmed by LukasPepunkt (Copper Contributor)
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

 

greyedOut.png

 

Rob
Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)

View solution in original post