Forum Discussion
JSON view and column formatting
Robin Nilsson As you suggested, it's now done!
If it helps with anything you write up to generate interest, this is what I sent to some folks in my sphere of influence:
Please help raise Microsoft’s awareness that we want SharePoint Online view and column formatting to be improved by voting for my https://sharepoint.uservoice.com/forums/329214-sites-and-collaboration/suggestions/38876674-enhance-view-and-column-formatting.
There some neat stuff that can be done using JSON, but it’s complicated and I haven’t run into a site owner or contributor yet who wants to learn how to write up the JSON.
In order to vote, you’re clicking on a Subscribe button that causes updates to be sent to you about the suggestion, but there’s a link at the bottom of every email message update that allows you to unsubscribe.
There are other people interested in this type of thing, but so far all the UserVoice suggestions are disjointed and haven’t gotten many votes, which you need in order to get Microsoft’s attention. (And … I thought it was pretty cool - I actually had someone from Oregon encourage me to post the idea. )
Thank you!
lindabusdiecker These are some great ideas!
If you are looking for a way to manage files and deployment directly from VS Code, DavidWarner has put together some samples of ways to do this with either PowerShell or the O365CLI. You can find all of that here: (fair warning, that, while powerful, it's definitely much more in the realm of development. But if things get daunting, David or I would be happy to help): https://github.com/SharePoint/sp-dev-list-formatting/tree/master/tools/general-dynamic-deployment-with-vscode
Your suggestion of providing out of the box interfaces to generate the JSON is a great one and one that Microsoft is actively working on. You'll see it in action on certain column types (datetime, choice, yes/no and a few others) and it's called Design Mode: https://www.youtube.com/watch?v=0sR7peVBNPk&list=PLR9nK3mnD-OXgMjDBdjWUTRia89oixBhx&index=14&t=0s
These are somewhat simplistic now but much more is coming in the future. The team demoed it at SPC last May and it should be pretty awesome. Hoping to see more about that soon.
You can implement comments in your JSON file by simply adding an attribute and setting the value. It's not super intuitive and could be better but it can be far better than forgetting how something works later. Fortunately, these values are totally ignored by the formatting engine and so they don't cause any problems. Here's a simple example:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType": "div",
"txtContent": "Hey there!",
"comment": "Totally useless format that just shows 'Hey there!', Wowee!"
}
The use of "comment" above is totally arbitrary (you can use whatever key you want).
I too would like to be able to reference a file for my formatting (similar to JS Link)! But in the meantime here are a couple of tips that I use:
- Site Columns can contain formats and this makes for a more centralized place to use them across your site collection. If a user changes the format on a list field you can simply update the site column and have it push down it's changes.
- PnP Provisioning templates fully support column and view formats. You can extract a template of your site and reapply at any time.
- Formats can be applied via PowerShell and the O365CLI (see above for examples) so writing centralized deployment scripts is fully possible
You can find other tips/demos here: https://www.youtube.com/playlist?list=PLR9nK3mnD-OXgMjDBdjWUTRia89oixBhx
- Robin NilssonOct 24, 2019Bronze Contributor
theChrisKent Thank you! Glad to hear the Design Mode will be expanded - that can take care of about of 30% of the customizations I've had to do in old SharePoint. And good tip about Site Columns - never thought of attacking the issue from that angle. Off to watch YouTube videos!
One of the reasons I'm not pushing harder for moving from On Premise to SPO is due to the little bits of formatting I've done to make life easier for folks - not critical enough to pull out PowerApps customizations but they would be missed. With updates to column/view formatting and the newly hinted at Form Customizations that could very well change...
- lindabusdieckerOct 24, 2019Brass Contributor
theChrisKent WOW - thank you! I've been watching your demos, but I love that you've provided links to some here, also have gone through your ECS 2019 slides (
https://www.slideshare.net/collabsummit/ecs19-chris-kent-list-formatting-in-office-365-and-sharepoint-2019) in depth - but you've added info here that I haven't seen before! We're also in the Government cloud, so are delayed in getting updates - I liked some of what I've seen in the demos.
I also plan to try to add samples to https://github.com/SharePoint/sp-dev-list-formatting once I can make time to go over some of the available intro materials and get familiar enough with GitHub!
I've loved that you've given content on some of the Community calls - that and PowerShell stuff shared by https://twitter.com/erwinvanhunen et al, make me feel like there's "Sharing is Caring love" for SCAs and power users too.