-
Notifications
You must be signed in to change notification settings - Fork 195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Page.cs and CanvasColumn.cs to handle collapsible sections correctly #1499
base: dev
Are you sure you want to change the base?
Conversation
Hey @mkm17 , I've just verified that our collapsible section test is working as expected (https://github.com/pnp/pnpcore/blob/dev/src/sdk/PnP.Core.Test/SharePoint/PagesTests.cs#L828-L910). Can you first verify that this is not working for you? |
Hi @jansenbe, sorry for the delay in response. I've been quite busy lately. In my testing, I tried adding some collapsible sections to the same page. The issue appears when there's already a collapsible section on the page. and I tried to add another one, I noticed that all properties related to the collapse function disappeared from the properties. For this page, I get this result -> Then, when we save the page, all previously set collapsible sections are, of course, gone. Maybe this issue occurs only with empty sections, but I still think we should address it. In the end, the result of the provided code is three empty sections. I hope that I haven't overlooked anything, like the version or any obvious settings. Let me know if you can reproduce the same behavior. My changes should resolve this issue, but since I'm not fluent with this repo, I hope they were added correctly. |
@mkm17 : can you verify that when then sections have content the same problem occurs? |
Hi @jansenbe, the sections with web parts are fine. The page before adding the section: The page after adding the section (the section without web parts has been cleared): If you need any further research, I’m here to help! |
@mkm17 : so the only issue is only with empty sections...not sure if we really need this as empty sections collapsed or not collapsed is almost the same |
@jansenbe, hi, and thank you for your comment. The same thing happens when saving an empty collapsible section, so this code without control inside does not work (at least in my case): https://pnp.github.io/pnpcore/using-the-sdk/pages-intro.html#configuring-page-sections. To add a little bit of background on why I am pushing for this change, I wanted to extend this command in PnP PowerShell: https://pnp.github.io/powershell/cmdlets/Add-PnPPageSection.html. Without the possibility to add a collapsible section to an empty section, it will be impossible to extend this command. If adding the next empty collapsible section resets all previous empty ones, then it won't be possible to add more empty sections using these commands in the future:
Of course, it is not a crucial change, so if it is better not to touch this part of the code in PnP Core, then I will just extend the PnP PowerShell commands like Add-PnPPageWebPart, which should work with the current setup. :) |
As mentioned in issue #1497, the following PR contains a fix for collapsible sections in SharePoint pages.