sp-dev-docs
sp-dev-docs copied to clipboard
Group Formatting not working
I have the following code to format a List view, and it always work. Now, the subgroup is not being formatted accordingly. I also, to make sure, left the column in the view, and even though it is not being formatted.
As-Now
As-it Used to be (second level - where marked in yellow in image above)
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/row-formatting.schema.json", "hideColumnHeader": true, "hideSelection": true, "hideFooter": true, "groupProps": { "hideFooter": true, "headerFormatter": { "elmType": "div", "style": { "display": "inline-flex", "align-items": "center", "height": "=if(@group.columnDisplayName == 'Assigned To', '16px', '12px')", "padding-left": "8px", "width": "=if(@group.columnDisplayName == 'Assigned To', '300px','350px')", "padding-top": "5px", "padding-bottom": "5px", "border-radius": "10px", "cursor": "pointer" }, "attributes": { "class": "=if(@group.columnDisplayName == 'Assigned To', 'ms-bgColor-neutralTertiaryAlt ms-fontColor-neutralSecondary', 'ms-bgColor-neutralLight ms-fontColor-themeLight--hover')" }, "children": [ { "elmType": "div", "txtContent": "=if(@group.columnDisplayName == 'Assigned To', @group.columnDisplayName + ':', 'ID ' + substring(@group.fieldData.title, indexOf(@group.fieldData.title,' '),0))", "children": [ { "elmType": "span" } ], "style": { "align-items": "center", "padding-right": "9px", "padding-bottom": "1px" }, "attributes": { "class": "=if(@group.columnDisplayName == 'Assigned To', 'ms-fontWeight-semibold ms-fontSize-10', 'ms-fontWeight-bold ms-fontSize-12')" } }, { "elmType": "img", "attributes": { "src": "=getUserImage(@group.fieldData.email, 'small')", "title": "@group.columnDisplayName" }, "style": { "align-items": "center", "width": "21px", "height": "21px", "border-radius": "50%", "display": "=if(@group.columnDisplayName == 'Assigned To','inherit','none')" } }, { "elmType": "div", "style": { "align-items": "center", "display": "inline-flex", "padding-right": "2px", "padding-bottom": "1px" }, "children": [ { "elmType": "span", "txtContent": "=if(@group.columnDisplayName == 'Assigned To', @group.fieldData.title, substring(@group.fieldData.title, indexOf(@group.fieldData.title + '^', '^'),indexOf(@group.fieldData.title,' ')))", "attributes": { "title": "@group.fieldData.title", "class": "=if(@group.columnDisplayName == 'Assigned To', 'ms-fontWeight-semibold', 'ms-fontSize-12')" }, "style": { "align-items": "center", "padding-left": "5px" } }, { "elmType": "div", "children": [ { "elmType": "span", "style": { "align-items": "center", "padding-left": "5px" }, "attributes": { "class": "=if(@group.columnDisplayName == 'Assigned To', 'ms-fontWeight-bold', 'ms-fontWeight-semibold ms-fontSize-10')" }, "txtContent": "='(' + @group.count +')'" } ] } ] } ] } } }
Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.
Is there an update on this problem? Is there a fix or a script to work around this problem? Because this is really annoying....
Is there an update on this problem? Is there a fix or a script to work around this problem? Because this is really annoying....
Somehow I fixed by reviewing the code; I believe they changed the they to get the code. i will share the reviewed code with you on Monday.
Hi
Thank you for your answer. Could you please share the reviewed code please?
Regards
Le sam. 22 juin 2024 à 11:56, teixeire @.***> a écrit :
Is there an update on this problem? Is there a fix or a script to work around this problem? Because this is really annoying....
Somehow I fixed by reviewing the code; I believe they changed the they to get the code. i will share the reviewed code with you on Monday.
— Reply to this email directly, view it on GitHub https://github.com/SharePoint/sp-dev-docs/issues/9303#issuecomment-2183965031, or unsubscribe https://github.com/notifications/unsubscribe-auth/AO6P65W4EMP7CSDXL4B7KMDZIVC4VAVCNFSM6AAAAABJWEQ5EKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBTHE3DKMBTGE . You are receiving this because you commented.Message ID: @.***>
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/row-formatting.schema.json", "hideColumnHeader": true, "hideSelection": true, "hideFooter": true, "groupProps": { "hideFooter": true, "headerFormatter": { "elmType": "div", "style": { "display": "inline-flex", "align-items": "center", "height": "=if(@group.columnDisplayName == 'Assigned To', '16px', '12px')", "padding-left": "8px", "width": "=if(@group.columnDisplayName == 'Assigned To', '300px','350px')", "padding-top": "5px", "padding-bottom": "5px", "border-radius": "10px", "cursor": "pointer" }, "attributes": { "class": "=if(@group.columnDisplayName == 'Assigned To', 'ms-bgColor-neutralTertiaryAlt ms-fontColor-neutralSecondary', 'ms-bgColor-neutralLight ms-fontColor-themeLight--hover')" }, "children": [ { "elmType": "div", "txtContent": "=if(@group.columnDisplayName == 'Assigned To', @group.columnDisplayName + ':', if(@group.columnDisplayName == 'ConcHeader', 'ID ' + (substring(toString(@group.fieldData), indexOf(@group.fieldData,' '),0)),''))", "style": { "align-items": "center", "padding-right": "9px", "padding-bottom": "1px" }, "attributes": { "class": "=if(@group.columnDisplayName == 'Assigned To', 'ms-fontWeight-semibold ms-fontSize-10', 'ms-fontWeight-bold ms-fontSize-12')" } }, { "elmType": "img", "style": { "align-items": "center", "width": "21px", "height": "21px", "border-radius": "50%", "display": "=if(@group.columnDisplayName == 'Assigned To','inherit','none')" }, "attributes": { "src": "=getUserImage(@group.fieldData.email, 'small')", "title": "@group.fieldData.title" } }, { "elmType": "div", "style": { "align-items": "center", "display": "inline-flex", "padding-right": "2px", "padding-bottom": "1px" }, "children": [ { "elmType": "div", "style": { "align-items": "center", "padding-left": "5px" }, "attributes": { "class": "=if(@group.columnDisplayName == 'Assigned To', 'ms-fontWeight-semibold', 'ms-fontSize-12')" }, "txtContent": "=if(@group.columnDisplayName == 'Assigned To', toString(@group.fieldData.title), substring(toString(@group.fieldData),indexOf(@group.fieldData,' '),80)" }, { "elmType": "span", "style": { "align-items": "center", "padding-left": "5px" }, "attributes": { "class": "=if(@group.columnDisplayName == 'Assigned To', 'ms-fontWeight-bold', 'ms-fontWeight-semibold ms-fontSize-10')" }, "txtContent": "='(' + @group.count +')'" } ] } ] } } }
I believe I added "toString" for @group.fieldData.title, but please compare both codes.
Sorry, but there's still the same problem: at the beginning, everything is nicely formatted. But as soon as I open and close a level, the values underneath are all the same (count is correct).
Without formatting, the values are correct, but not with formatting. But I need to remove the field title and to color the 2 levels differently.
Hi Look the issue : https://github.com/SharePoint/sp-dev-docs/issues/9794. It is the same.
Hello @teixeire, Thank you for bringing this issue to our attention. Could you please confirm if the issue still persists for you?
We are closing this issue for now. If the problem persists, feel free to reopen it or open a new one.