sp-dev-docs
sp-dev-docs copied to clipboard
List Formatting: Group header cannot be clicked even when setting `defaultClick` to `headerFormatter` in `groupProps` in the newer? Microsoft Lists
Target SharePoint environment
SharePoint Online
What SharePoint development model, framework, SDK or API is this about?
Declarative list formatting
Developer environment
Windows
What browser(s) / client(s) have you tested
- [ ] 💥 Internet Explorer
- [X] 💥 Microsoft Edge
- [X] 💥 Google Chrome
- [ ] 💥 FireFox
- [ ] 💥 Safari
- [ ] mobile (iOS/iPadOS)
- [ ] mobile (Android)
- [ ] not applicable
- [ ] other (enter in the "Additional environment details" area below)
Additional environment details
No response
Describe the bug / error
In the newer? Microsoft Lists, I cannot click on the group header even though I set defaultClick
to headerFormatter
in groupProps
.
In the older? Microsoft Lists, clicking on a group header with defaultClick set would display a view filtered by the value of that group header.
Steps to reproduce
- Create a list
- Create a choice column
- Create some items
- Grouping by choice column created in 2.
- Set the following JSON in the view formatting
Sample Code
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/row-formatting.schema.json",
"groupProps": {
"headerFormatter": {
"elmType": "div",
"style": {
"font-size": "16px",
"cursor": "pointer",
"padding": "5px 10px",
"border-radius": "5px"
},
"customRowAction": {
"action": "defaultClick"
},
"attributes": {
"class": "ms-bgColor-themeLighter ms-bgColor-themePrimary--hover ms-fontColor-white--hover"
},
"children": [
{
"elmType": "span",
"txtContent": "@group.fieldData.displayValue"
},
{
"elmType": "span",
"style": {
"margin-left": "5px"
},
"txtContent": "=' ('[email protected]+')'"
}
]
}
}
}
Expected behavior
Clicking on a group header with defaultClick
set will display a view filtered by the value of the group header, similar to the older Microsoft Lists