I have a column in Sharepoint 2013 and set the type to 'Calculated'. I have set the data return type to integer (pic attached) so that the field is hyperlink.
All worked fine for over a year in all environments (dev and production) and browsers (chrome, firefox, IE) until recently when users reportted the hyperlink was not clickable anymore and displayed as text (pic attached). Inspecting the element, reveals the value of is treated as text.
我花了一些时间简化公式,删除字段并使用一个简单的元素导航到谷歌,但还没有找到解决方案。我怀疑可能有一个 Sharepoint 更新,它以不同的方式处理公式,在用双引号包围它的元素内创建文本。
经过研究,我找到了问题的原因和解决方案。
Cause
SharePoint 更新删除了计算字段设置标记的功能,并在中进行了解释处理 SharePoint 计算字段中的 HTML 标记 https://support.microsoft.com/en-gb/help/4032106/handling-html-markup-in-sharepoint-calculated-fields.
Solution
我已经找到了 JSLink 的解决方案。打开上面的链接后,有一些使用 JSLink 的示例。经过一番尝试,我成功地将计算字段作为超链接。步骤很简单。
使用代码创建一个 js 文件 - 在我的例子中,我创建一个超链接,将当前项目的值发布到另一个列表。
复制js文件的链接位置。
在“其他”部分下查看 Web 部件上的参考 js 文件。
Voila!
注意:在脚本中,字段名称必须是内部字段名称,这让我的速度慢了很多。要获取内部字段名称,请打开列表设置,将鼠标悬停在所需字段上,然后在浏览器的左下角您将获得内部字段名称(此处 Field=内部字段名称)。
JS示例可以找到here https://code.msdn.microsoft.com/office/Client-side-rendering-JS-2ed3538a.
另一篇有用的读物here https://www.codeproject.com/Articles/620110/SharePoint-Client-Side-Rendering-List-Views.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)