How to retain single click when formatting column

Vanessa 356 Reputation points
2023-12-06T12:44:33.21+00:00

In a document library, you can normally click an item once to open. If I use the following JSON code to allow the file name to wrap, I have to double click the file name to open the item. How can get the single click function?

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "div",
  "style": {
    "word-break": "normal",
    "white-space": "wrap"
  },
  "children": [
    {
      "elmType": "span",
      "txtContent": "@currentField"
    }
  ]
}

Microsoft 365 and Office SharePoint For business Windows
0 comments No comments
{count} votes

Accepted answer
  1. Xyza Xue_MSFT 30,176 Reputation points Microsoft External Staff
    2023-12-07T02:44:47.3866667+00:00

    Hi @Vanessa ,

    I tested it against the JSON code you provided, but it didn't quite work for me, my "Document11111111111......" filename has no wrap.

    namewrap

    As we can easily drag the length of the column, automatic line wrapping is canceled by default in SharePoint Online. You can use the column JSON format to allow the file name to wrap. But this only applies to Title(in Lists). Filename (in Document Libraries) is currently not supported. That's probably why your retain single click doesn't work!

    Please refer to this article:https://learn.microsoft.com/en-us/sharepoint/dev/declarative-customization/column-formatting#supported-column-types

    User's image

    I recommend you give suggestion in the feedback portal and help to make improvements. Many features of current products are designed and upgraded based on customers’ feedback. With requirements like this increase, the problem may well be released in the future. I will vote for you.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.