Unable to select list item with horizontal view format

Viewed 2235

Trying to achieve a horizontal tiled/button view in a SharePoint list, to work with an associated list properties webpart, however item selection is not working, looking for workaround in JSON if possible.

I tried looking for a customRowAction setting that could work the same way, but found nothing. "hideSelection": "true", seems to completely turn off the ability to select an item.

I would like to be able to click on a list item and it resgister as a "selected" item to trigger the associated List Properties webpart to display the items content. OOTB this functions as expected but not with the list view styling shown in the JSON.

{
  "schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json",
  "hideSelection": "true",
  "hideColumnHeader": "true",
  "rowFormatter": {
    "elmType": "div",
    "style": {
      "float": "left"
    },
    "children": [
      {
        "elmType": "button",
        "customRowAction": {
          "action": "defaultClick"
        },
        "attributes": {
          "class": "ms-bgColor-themeLighterAlt ms-bgColor-themePrimary--hover ms-fontColor-white--hover"
        },
        "style": {
          "display": "flex",
          "flex-wrap": "wrap",
          "min-width": "150px",
          "min-height": "50px",
          "margin-right": "10px",
          "margin-top": "10px",
          "box-shadow": "2px 2px 4px darkgrey"
        },
        "children": [
          {
            "elmType": "div",
            "style": {
              "text-align": "center",
              "margin": "auto"
            },
            "children": [
              {
                "elmType": "div",
                "attributes": {
                  "class": "sp-row-title "
                },
                "txtContent": "[$Phase]"
              }
            ]
          }
        ]
      }
    ]
  }
}
1 Answers

If you want to show the item in List Properties web part, you need use the default list view styling, if you use JSON formatting to customize the list view, it will not works.

Using your JSON formatting, when we click the button, we can see the item data in the panel in the same page. Why do you want to show in List Properties web part?

enter image description here

Related