0

I have a List in a SharePoint Online site that uses the Modern experience. I want to hide a column, but need to stay in Modern. The easy way I found was inserting a few lines of Javascript in a Script Editor webpart, but this would require switching to the Classic experience. I can't go to Classic because I have column formatting code with JSON that needs to be displayed. And I can't just remove the column from the view, because the JSON formatting references this column.

7
  • 1
    If you remove column from list view...json formatting is not working?? – Ganesh Sanap Mar 12 '19 at 18:26
  • Yes, the JSON formatting on another column relies on the column that I want to hide. The column "FST Sprint" has JSON formatting that references the "FSTSprintStatus" column to apply its background color. So, if FSTSprintStatus is "Red", the background color of "FST Sprint" will change to red. But, I don't want the user to see the Status column. – wahle509 Mar 12 '19 at 18:53
  • I guess you can hide the status value somehow in json formatting itself?? – Ganesh Sanap Mar 12 '19 at 18:55
  • I need the whole column to be hidden. – wahle509 Mar 12 '19 at 19:00
  • 1
    If you want to highlight the rows in list, you can highlight them in classic view too... By using client side rendering and JSLink. – user80093 Mar 12 '19 at 19:02
3

Check the article: Customizing "modern" lists and libraries

We can't add JavaScript or CSS code in the modern list view page.

As a workaround, we can hide the column value using column formatting below, we can't hide the whole column if you need use this column value in another column formatting.

{
   "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
   "elmType": "div",
   "txtContent": "@currentField",
   "style": {
      "display": "none"
   }
}
2
  • I am sad we can't reference hidden columns from another column's JSON column formatting. The reason I am hiding the column in the first place, is to make a calculated column based on its value, but the column formatting I am wanting to apply to the calculated column needs to reference the original value in the hidden column (which is a date and not text (which the calculated column outputs)). – user1063287 2 days ago
  • PS - there seems to be some sort of workaround here, but I have read the article and the tips in the comments multiple times and cannot understand what they are suggesting: devscopeninjas.azurewebsites.net/2019/03/18/… – user1063287 2 days ago

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.