I have been searching the web to try and find an answer to this question however, all pages seem to relate to just 1 column grouping.
I have a list of people who are grouped together as gangs and then for the company that they work for.
This page SharePoint Online list - format group headers to remove column name accomplishes the sort of view that I am looking for however, when I add the following JSON, the gang does not display:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/row-formatting.schema.json",
"groupProps": {
"headerFormatter": {
"elmType": "div",
"style": {
"padding-left": "12px",
"font-size": "16px",
"font-weight": "400",
"cursor": "pointer",
"outline": "0px",
"white-space": "nowrap",
"text-overflow": "ellipsis"
},
"children": [
{
"elmType": "div",
"children": [
{
"elmType": "span",
"style": {
"padding": "5px 5px 5px 5px"
},
"txtContent": "@group.fieldData.title"
}
]
},
{
"elmType": "div",
"children": [
{
"elmType": "div",
"style": {
"display": "flex",
"flex-direction": "row",
"justify-content": "center"
},
"children": [
{
"elmType": "div",
"txtContent": "=' (' + @group.count + ')'"
}
]
}
]
}
]
}
}
}
However, if I leave @group.fieldData.displayValue
it displays as [Object] [Object]
.
What I am looking to achieve is the Company Name in a group without being preceded with "Company Name:" and also the Gang Name in a group without being preceded with "Gang Name:".
@group.fieldData.lookupValue
instead of@group.fieldData.DisplayValue
. Let me know if it works for you.