Hi, sorry for being brief, but the official MS Q&A just kept deleting my question when I added the view JSON.
Broad Overview
I would like to affect the same action as tapping the chevron in a Grouped view, without malforming the header.
Illustrated
One attempt that I have made to try and resolve this was to add a customRowAction (as per the code below) I get the following annoyance:
Before

After

More Information
Attempts
I have tried issuing the base object as both a button and a div, neither make a difference.
On top of that, I have tried a few different attributes ripped from the chevron button's HTML code, but they don't change anything.
{
"data-is-focusable": "false",
"data-selection-disabled": "true",
"type": "button",
"class": "ms-GroupHeader-expand",
"aria-expanded": "false",
"aria-label": "Expand or collapse group Title : Do Not Use General Storage",
"tabindex": "-1",
"role": "gridcell"
}
I have also tried shoehorning in the customRowAction, in both the Group/Header and the RowFormatter, neither assist, here.
Plus, as @Fedes365 asserts, it really needs to be in the RowFormatter anyway. But, hey ... I was trying stuff out.
Full Code
This includes the customRowAction in the header ...
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/row-formatting.schema.json",
"hideSelection": true,
"hideColumnHeader": true,
"hideListHeader": true,
"groupProps": {
"headerFormatter": {
"elmType": "div",
"attributes": {
"class": "sp-row-card"
},
"customRowAction": {
"action": "defaultClick"
},
"style": {
"color": "black",
"background-color": "#FAF9F9",
"flex-grow": "1",
"display": "flex",
"flex-direction": "row",
"box-sizing": "border-box",
"padding": "4px 8px 5px 8px",
"border-radius": "6px",
"align-items": "center",
"flex-wrap": "nowrap",
"overflow": "auto",
"margin": "1px 4px 4px 1px",
"width": "fit-content"
},
"children": [
{
"elmType": "img",
"style": {
"max-width": "24px",
"max-height": "24px",
"margin-top": "2px",
"border-radius": "2px"
}
},
{
"elmType": "div",
"children": [
{
"elmType": "span",
"style": {
"padding": "5px 5px 5px 5px",
"font-weight": "500",
"font-size": "15px"
},
"txtContent": "@group.fieldData.displayValue"
}
]
},
{
"elmType": "div",
"children": [
{
"elmType": "div",
"style": {
"display": "flex",
"flex-direction": "column",
"justify-content": "center"
}
}
]
}
]
}
},
"rowFormatter": {
"elmType": "div",
"attributes": {
"class": "ms-bgColor-themeLighterAlt"
},
"style": {
"justify-content": "start",
"color": "ms-fontColor-Primary",
"display": "flex",
"padding": "1px 8px 5px 20px",
"border-radius": "6px",
"max-width": "905px",
"margin": "1px 4px 4px 60px"
},
"children": [
{
"elmType": "div",
"style": {
"text-align": "left",
"font-weight": "400",
"font-size": "15px",
"display": "flex",
"flex-flow": "row nowrap"
},
"children": [
{
"elmType": "span",
"style": {
"margin-top": "8px",
"padding-left": "1px",
"color": "black",
"height": "fit-content"
},
"attributes": {
"class": "ms-fontSize-m",
"iconName": "Lightbulb"
}
},
{
"elmType": "div",
"attributes": {
"class": "sp-row-listPadding"
},
"txtContent": "[$Description]",
"style": {
"flex-grow": "1",
"display": "flex",
"flex-direction": "column",
"flex-wrap": "nowrap",
"align-items": "center",
"max-width": "900px",
"min-width": "205px",
"margin-top": "8px",
"padding-left": "4px",
"margin-bottom": "8px"
}
}
]
}
]
}
}
Hi, sorry for being brief, but the official MS Q&A just kept deleting my question when I added the view JSON.
Broad Overview
I would like to affect the same action as tapping the chevron in a Grouped view, without malforming the header.
Illustrated
One attempt that I have made to try and resolve this was to add a
customRowAction(as per the code below) I get the following annoyance:Before
After
More Information
Attempts
I have tried issuing the base object as both a button and a div, neither make a difference.
On top of that, I have tried a few different attributes ripped from the chevron button's HTML code, but they don't change anything.
{ "data-is-focusable": "false", "data-selection-disabled": "true", "type": "button", "class": "ms-GroupHeader-expand", "aria-expanded": "false", "aria-label": "Expand or collapse group Title : Do Not Use General Storage", "tabindex": "-1", "role": "gridcell" }I have also tried shoehorning in the
customRowAction, in both the Group/Header and the RowFormatter, neither assist, here.Plus, as @Fedes365 asserts, it really needs to be in the RowFormatter anyway. But, hey ... I was trying stuff out.
Full Code
This includes the
customRowActionin the header ...{ "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/row-formatting.schema.json", "hideSelection": true, "hideColumnHeader": true, "hideListHeader": true, "groupProps": { "headerFormatter": { "elmType": "div", "attributes": { "class": "sp-row-card" }, "customRowAction": { "action": "defaultClick" }, "style": { "color": "black", "background-color": "#FAF9F9", "flex-grow": "1", "display": "flex", "flex-direction": "row", "box-sizing": "border-box", "padding": "4px 8px 5px 8px", "border-radius": "6px", "align-items": "center", "flex-wrap": "nowrap", "overflow": "auto", "margin": "1px 4px 4px 1px", "width": "fit-content" }, "children": [ { "elmType": "img", "style": { "max-width": "24px", "max-height": "24px", "margin-top": "2px", "border-radius": "2px" } }, { "elmType": "div", "children": [ { "elmType": "span", "style": { "padding": "5px 5px 5px 5px", "font-weight": "500", "font-size": "15px" }, "txtContent": "@group.fieldData.displayValue" } ] }, { "elmType": "div", "children": [ { "elmType": "div", "style": { "display": "flex", "flex-direction": "column", "justify-content": "center" } } ] } ] } }, "rowFormatter": { "elmType": "div", "attributes": { "class": "ms-bgColor-themeLighterAlt" }, "style": { "justify-content": "start", "color": "ms-fontColor-Primary", "display": "flex", "padding": "1px 8px 5px 20px", "border-radius": "6px", "max-width": "905px", "margin": "1px 4px 4px 60px" }, "children": [ { "elmType": "div", "style": { "text-align": "left", "font-weight": "400", "font-size": "15px", "display": "flex", "flex-flow": "row nowrap" }, "children": [ { "elmType": "span", "style": { "margin-top": "8px", "padding-left": "1px", "color": "black", "height": "fit-content" }, "attributes": { "class": "ms-fontSize-m", "iconName": "Lightbulb" } }, { "elmType": "div", "attributes": { "class": "sp-row-listPadding" }, "txtContent": "[$Description]", "style": { "flex-grow": "1", "display": "flex", "flex-direction": "column", "flex-wrap": "nowrap", "align-items": "center", "max-width": "900px", "min-width": "205px", "margin-top": "8px", "padding-left": "4px", "margin-bottom": "8px" } } ] } ] } }