Forum Discussion
Grayson1530
Feb 04, 2021Copper Contributor
Trying to Change the Gallery View with JSON to open custom URL instead of edit item menu
I have a simple list as follows: I'm trying to update the Gallery view so that when you click on the tile it opens the URL in "Form Link" instead of opening the standard "edit item" menu. I ...
- May 25, 2022If you remove the two lines of code for the customRowAction section, replace "button" with "a" and then add the following two lines of code below "role": "presentation", it should work. Just replace [@Place] with the name of your field that is the hyperlink.
"href": "[$Place]",
"target": "_blank"
MichelleN1790
May 25, 2022Copper Contributor
Grayson1530 I am also a JSON newbie. I don't know if this is the correct way but it worked for me. I removed the following lines from my gallery JSON. Now, only the text shows as an active link when hovering over or selecting it; not the whole tile. No more display form; only my custom link.
{
"elmType": "button",
"attributes": {
"class": "sp-card-defaultClickButton",
"role": "presentation"
},
"customRowAction": {
"action": "defaultClick"
}
},
- rgwinnMay 25, 2022Brass ContributorIf you remove the two lines of code for the customRowAction section, replace "button" with "a" and then add the following two lines of code below "role": "presentation", it should work. Just replace [@Place] with the name of your field that is the hyperlink.
"href": "[$Place]",
"target": "_blank"- ABB_ComAug 28, 2023Copper Contributor
rgwinn When I use the code, it seems that the URL is being blocked:
Do you know, what can be the cause of this?
- ganeshsanapAug 28, 2023MVP
ABB_Com What is the URL you are using in the JSON?
Make sure you are using the correct internal name of your column instead of [$Place]. You can get the internal name of your column by following this article: How to find the Internal name of columns in SharePoint Online?
If that does not solve your issue, please share the complete JSON you are using for view formatting.
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
- rgentileApr 12, 2023Brass ContributorThanks for sharing your knowledge rgwinn. This worked for me!