SharePoint JSON View with folders

Copper Contributor

I am trying to use the Document library sample at https://github.com/pnp/sp-dev-list-formatting/tree/master/view-samples/document-library to create a custom view for a policy library. 

What I want however is to separate each departments draft policies into folders or document sets (so that only certain members can edit the drafts). I can get the view work for the documents but I would like the folder level to show like normal. There should be no files saved at the top level.

Is there any way that I can modify the JSON to check for the content type? This isn't as simple as some of the formats that are applying an additionalRowClass where it checks for a folder since there is a lot of code.

 

Thanks

2 Replies

@Paul Rudy  Hi.. did you ever find out ? I'd like the same behaviour :)

@sacker95 What I ended up doing is adding is adding lines to check for the content type of the document library and either showing or hiding children depending upon whether or not I am showing the document set:

"style": {
   "display": "=if([$ContentType] == 'Policy Documents', '','none')"
}

or

"style": {
   "display": "=if([$ContentType] == 'Policy Documents', 'none','')"
},