SOLVED

Hiding commands using JSON Format doesn't work in web part

Copper Contributor

I have a document library that I would like to show in the home page of a modern SharePoint site. I added the document library web part to the page, selected the folder I want to show, and selected the view I want to use. In this view I used JSON to hide and move around some of the commands from the command bar:

 

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/row-formatting.schema.json",
  "commandBarProps": {
    "commands": [
      {
        "key": "new",
        "hide": false
      },
      {
        "key": "sync",
        "hide": true
      },
      {
        "key": "editInGridView",
        "hide": true
      },
      {
        "key": "download",
        "hide": true
      },
      {
        "key": "automate",
        "sectionType": "Overflow",
        "position": 3
      },
      {
        "key": "manageAlert",
        "sectionType": "Overflow",
        "position": 1,
        "iconName": "AlertSettings",
        "text": "Edit and Manage Alerts"
      },
      {
        "key": "alertMe",
        "sectionType": "Overflow",
        "position": 2,
        "iconName": "WorkItemAlert"
      },
      {
        "key": "export",
        "sectionType": "Overflow",
        "position": 5,
        "iconName": "ExcelDocument"
      },
      {
        "key": "integrate",
        "sectionType": "Overflow",
        "position": 4
      },
      {
        "key": "share",
        "position": 6,
        "sectionType": "Overflow",
        "title": "Share this List"
      }
    ]
  }
}

It works perfectly when I'm in the library itself:

1.png

 

But it doesn't when I add this library to a page as a web part:

2.png

 

Is it possible to modify which commands to show/hide from a document library when it is a web part in a page?

 

 

2 Replies
best response confirmed by CubanGuy (Copper Contributor)
Solution

@CubanGuy Unfortunately, document library web part added on site pages does not support all JSON formatting features similar to SharePoint default document library page.


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.

@CubanGuy 

 

On top of @ganeshsanap's input, make sure that you have set correct view in web part where you can configured JSON formatting because row formatting is associated with View

 

kalpeshvaghela_2-1662702237768.png

 

kalpeshvaghela_3-1662702286666.png

 

 


Hope it will helpful to you and if so then Please mark my response as Best Response & Like to help others in this community

1 best response

Accepted Solutions
best response confirmed by CubanGuy (Copper Contributor)
Solution

@CubanGuy Unfortunately, document library web part added on site pages does not support all JSON formatting features similar to SharePoint default document library page.


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.

View solution in original post