0
votes

I am using SharePoint online and would like to use row formatting on a document library.

Ideally i like the tile view for the documents. However, it only shows the "name" of the file. I would like to use the Title instead of the Name and i prefer to keep the same tile view style.

Any ideas how to do this?

Thanks.

1

1 Answers

0
votes

We can't use view formatting for the default Tiles style view, we need create following view formatting for List style view.

{
  "schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json",
  "hideSelection": "true",
  "hideColumnHeader": "true",
  "rowFormatter": {
    "elmType": "a",
    "attributes": {
      "href": "[$FileRef]",
      "target": "'_blank'"
    },
    "style": {
      "float": "left"
    },
    "children": [
      {
        "elmType": "div",
        "attributes": {
          "class": "ms-bgColor-themeLighterAlt ms-bgColor-themePrimary--hover ms-fontColor-white--hover"
        },
        "style": {
          "display": "flex",
          "flex-wrap": "wrap",
          "min-width": "180px",
          "min-height": "150px",
          "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": "[$Title]"
              },
              {
                "elmType": "div",
                "attributes": {
                  "iconName": "Test",
                  "class": "ms-fontSize-su"
                }
              }
            ]
          }
        ]
      }
    ]
  }
}

Refer to: sp-dev-list-formatting>generic-tile-format