pnp/List-Formatting

Announcements are not fully hidden

Closed this issue · 2 comments

Sample (which sample are you having trouble with)

Announcements

What Should Happen

The announcement ticket has been working great. It hides the rows that are between the start date and removal date columns in our sharepoint list.
image

What Actually Happens

All of a sudden, the list elements are almost hidden, but are pushing the visible announcement down. The area that has been pushed can be clicked into, and rows of the sharepoint list are open in edit mode. I hope this makes sense.
image.

FORMAT VIEW JSON

{ "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/row-formatting.schema.json", "hideColumnHeader": true, "hideSelection": true, "rowFormatter": { "elmType": "div", "style": { "width": "300px", "padding-bottom": "20px", "display": "=if(([$StartDate] <= @now) && ([$RemoveDate] >= @now), '', 'none !important')", "visibility": "=if(([$StartDate] <= @now) && ([$RemoveDate] >= @now), '', 'hidden !important')" }, "children": [ { "elmType": "div", "style": { "border-radius": "8px", "box-shadow": "#00000022 0px 1.6px 3.6px 0px, #00000022 0px 0.3px 0.9px 0px", "display": "flex", "font-size": "1rem", "background-color": "=if([$TypeAnn] == 'Red', '#fdeded', if([$TypeAnn] == 'Green', '#edf7ed', if([$TypeAnn] == 'Yellow', '#fff4e5', '#e5f6fd')))", "line-height": "1.43", "padding": "6px 16px", "align-items": "center", "flex-flow": "wrap" }, "children": [ { "elmType": "span", "attributes": { "iconName": "=if([$TypeAnn] == 'Red', 'ErrorBadge', if([$TypeAnn] == 'Green', 'Completed', if([$TypeAnn] == 'Yellow', 'warning', 'info')))" }, "style": { "padding-right": "10px", "font-weight": "700", "color": "=if([$TypeAnn] == 'Red', '#ef5350', if([$TypeAnn] == 'Green', '#4caf50', if([$TypeAnn] == 'Yellow', '#ff9800', '#03a9f4')))" } }, { "txtContent": "[$Category]", "elmType": "div", "style": { "font-weight": "630", "margin-bottom": "0.35em", "padding-right": "5em" } }, { "elmType": "span", "style": { "font-weight": "500" }, "attributes": { "iconName": "CRMCustomerInsightsApp" }, "customCardProps": { "formatter": { "elmType": "div", "txtContent": "[$TextHover]", "style": { "display": "=if([$TextHover], 'block', 'none')", "align-items": "stretch", "border-radius": "8px", "box-shadow": "#00000022 0px 1.6px 3.6px 0px, #00000022 0px 0.3px 0.9px 0px", "background-color": "=if([$TypeAnn] == 'Red', '#fdeded', if([$TypeAnn] == 'Green', '#edf7ed', if([$TypeAnn] == 'Yellow', '#fff4e5', '#e5f6fd')))", "font-size": "1rem", "line-height": "1.43", "padding": "6px 16px", "flex-flow": "wrap" } }, "openOnEvent": "click", "directionalHint": "topCenter", "isBeakVisible": true, "beakStyle": { "background-color": "=if([$TypeAnn] == 'Red', '#fdeded', if([$TypeAnn] == 'Green', '#edf7ed', if([$TypeAnn] == 'Yellow', '#fff4e5', '#e5f6fd')))" } } }, { "elmType": "div", "txtContent": "[$Description]", "style": { "padding-left": "26px", "flex-direction": "column" } } ] } ] } }

Hi @toxxicjtag ! It was reproduced in my environment.
image

Causes announcements to be pushed down

All of a sudden, the list elements are almost hidden, but are pushing the visible announcement down.

The reason the announcement was pushed down was due to a change in the Microsoft Lists specification, or a bug, which allowed for blank space under every row.

image

This blank space is created even if the row is hidden as "display" : "none".

image

⚠️ I have created an issue in the sp-dev-docs repository and asked Microsoft about whether this blank space is a bug or a spec change. (Not sure if I will get an answer...)
SharePoint/sp-dev-docs#9971

About Measures

If you want to restore the announcement to its original position, please try using a filter to not retrieve the hidden rows.

image

However, when using filters, filter criteria will be displayed above the view....

image

Thank you for the update. I will play around with the list filters to see if it works.