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.

  • If you remove column from list view...json formatting is not working?? – Ganesh Sanap Mar 12 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 at 18:53
  • I guess you can hide the status value somehow in json formatting itself?? – Ganesh Sanap Mar 12 at 18:55
  • I need the whole column to be hidden. – wahle509 Mar 12 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. – sharepoint_geek Mar 12 at 19:02
0

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"
   }
}

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.