Forum Discussion
How to edit existing Sharepoint Document Library with SPFx
- Oct 30, 2023
You can definitely add more than 2 buttons or more than 2 nested if conditions in JSON formatting expressions.
For example, I have used more than 200 nested if conditions here: SharePoint Online: Display Country Flags using JSON Formatting – multiple selections
Also, you can show/hide buttons in JSON formatting based on existing column values with the help of display CSS property.
For customizing list/library forms, you can either use Power Apps (low code solution) or using SPFx form customizer (coding experience required).
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
- What are the exact changes you want to do in SharePoint document library view?
- You can show/hide columns from library view using SharePoint out of the box options
- If you need to show/hide other elements based on DOM manipulation, you might need to create SPFx Application Customizer. Read more about it at: How can I include the same JS and CSS files on multiple SharePoint Modern Page?
- What advanced button functionality you need in your library?
- You can do few things like updating column values, calling flow using SharePoint JSON formatting. Examples:
- For more advanced functionalities which cannot be achieved using JSON formatting, you can use SPFx Field Customizer (button for each row) or SPFx ListView Command Set (buttons in library command bar at the top)
You do not need to setup the MS 365 developer tenant if you already have access to Microsoft 365 tenant where you can test and deploy your SPFx solution.
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
ganeshsanap
First of all thank you for your extensive reply! Really appreciate it. To address some of your questions:
1. As for manipulating the view I'm trying to solve this issue that I previously inquired about at the https://powerusers.microsoft.com/t5/Building-Power-Apps/Edit-form-when-uploading-a-new-document/m-p/2400781#M599173
2. As for the buttons, for example I have a button that has 3 states based on the flow with different text and color:
From my understanding the JSON formatting can only handle 2 versions with the if statement. I tried adding a third state but this was unsuccesful. I also kind of need to 'disable' buttons, meaning that once an user has clicked on the TEXT 1 button it should be non clickable. I now use a different cursor but users can still technically click on it and start the flow again.
- ganeshsanapOct 30, 2023MVP
You can definitely add more than 2 buttons or more than 2 nested if conditions in JSON formatting expressions.
For example, I have used more than 200 nested if conditions here: SharePoint Online: Display Country Flags using JSON Formatting – multiple selections
Also, you can show/hide buttons in JSON formatting based on existing column values with the help of display CSS property.
For customizing list/library forms, you can either use Power Apps (low code solution) or using SPFx form customizer (coding experience required).
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.