pnp / List-Formatting

List Formatting Samples for use in SharePoint and Microsoft Lists
https://pnp.github.io/List-Formatting/
MIT License
1.7k stars 823 forks source link

I have a question about Group Header Status Icon Color #750

Closed Elonmuskis closed 7 months ago

Elonmuskis commented 7 months ago

Hello, I have a question with formatting of Group Header Status Icon Color. Ive used the Code below in formatting of the Column and View, but still the code doesn't provide the intended use case.

{ "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/row-formatting.schema.json", "groupProps": { "headerFormatter": { "elmType": "div", "style": { "flex-direction": "row" }, "children": [ { "elmType": "div", "attributes": { "class": "=if(@group.fieldData == 'Pending', 'sp-css-backgroundColor-BgCornflowerBlue', if(@group.fieldData == 'Approved', 'sp-css-backgroundColor-BgMintGreen',if(@group.fieldData == 'On Hold', 'sp-css-backgroundColor-BgGold',if(@group.fieldData == 'Rejected', 'sp-css-backgroundColor-BgCoral','sp-field-borderAllRegular sp-field-borderAllSolid sp-css-borderColor-neutralSecondary'))))" }, "style": { "display": "inline-flex", "height": "25px", "border-radius": "15px", "padding-left": "8px", "padding-top": "5px" }, "children": [ { "elmType": "span", "attributes": { "iconName": "=if(@group.fieldData == 'On Hold', 'CirclePauseSolid', if(@group.fieldData == 'Approved', 'SkypeCircleCheck',if(@group.fieldData == 'Pending', 'ClipboardListQuestion',if(@group.fieldData == 'Rejected', 'Blocked','StatusCircleQuestionMark'))))" }, "style": { "padding-right": "6px", "padding-top": "2px" } }, { "elmType": "div", "style": { "display": "inline-flex", "padding-right": "9px" }, "children": [ { "elmType": "div", "style": { "padding-left": "5px" }, "attributes": { "class": "ms-fontWeight-bold" }, "txtContent": "=@group.count" }, { "elmType": "div", "style": { "padding-left": "5px" }, "attributes": { "class": "ms-fontWeight-normal" }, "txtContent": "= if(@group.count!= 1,'Items are','Item is')" }, { "elmType": "div", "txtContent": "=@group.fieldData", "attributes": { "title": "=@group.fieldData", "class": "ms-fontWeight-bold" }, "style": { "padding-left": "5px" } } ] } ] } ] } } }

GroupHeaderIconColor.pdf

Fedes365 commented 7 months ago

Hello @Elonmuskis

I've opened your pdf attached to this issue and I've noticed that the items are not grouped according to the "Status" column 🤔

immagine

Fedes365 commented 7 months ago

Here is my result after grouping items according to the Status column:

immagine

Elonmuskis commented 7 months ago

Thank you Fedes. I forgot to Group the Status Column. Now after I did that and put the code in the Formatting of the View (of the List) it worked. Thank you again and have a nice day ;).

tecchan1107 commented 7 months ago

Thank you @Fedes365 🙏✨