Forum Discussion
How to extract standard/custom column JSON formatting from Sharepoint List View?
roktoro By default there is no JSON formatting applied to Name (Linkfilename) column, hence you cannot copy or mimic it to another columns.
However, you can open the context menu (with extra functions like open/share/delete file) using JSON column formatting and customRowAction.
Simple Example:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"txtContent": "@currentField",
"customRowAction": {
"action": "openContextMenu"
}
}
Note:
- Context menu will be opened on "click" of column value and not on "hover" using above JSON
- You can apply additional formatting to above JSON to show it as button or with extra formatting like font-size, color, etc. Refer: SharePoint JSON formatting syntax reference
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.
- roktoroMar 19, 2024Copper Contributor
1. I suppose same answer applies how to get tick/no tick mark formatting for boolean type column. There might be workaround, but no way to extract it as JSON code straight away from standard formatting for re-apply and/or customization, am I right?2. Is there a way to extract style settings to be customized with JSON?
If I change default column formatting with something like:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"txtContent": "@currentField"
}I'm not getting the same look as with "default" column formatting, so I wonder - is there an easy way to extract style information for further customization with JSON?
- ganeshsanapMar 19, 2024MVP
roktoro Yes, same thing. However, there are few list formatting samples provided by community members on GitHub. You can look at those, use those as is or customize the JSON as per your requirements.
Check this link for all list formatting sample: List Formatting Samples
Check this link for column formatting sample: List of Column Formatting Samples
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.