Sharepoint 2013计算字段作为超链接呈现为文本 [英] Sharepoint 2013 calculated field as hyperlink renders as text

查看:134
本文介绍了Sharepoint 2013计算字段作为超链接呈现为文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Sharepoint 2013中有一列,并将类型设置为计算".我已将数据返回类型设置为整数(附加图片),以便该字段为超链接.

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.

在所有环境(开发和生产)和浏览器(chrome,firefox,IE)中,所有这些在过去一年中都工作良好,直到最近用户报告超链接不再可单击并显示为文本(附有图片)为止.检查元素,将显示的值视为文本.

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.

我花了一些时间来简化公式,删除字段并使用一个简单的元素来导航到google,但没有找到解决方案.我怀疑可能有一个Sharepoint更新,该更新处理的公式与在双引号周围的元素内创建文本的方式不同.

I have spent some time simplifying the formula, removing fields and having a simple element to navigate to google, but have not found a solution. I suspect there may been a Sharepoint update which handles the formula differently creating text inside the element surrounding it with double quotes.

推荐答案

研究后,我找到了问题的原因和解决方案.

After research I have found the cause and the solution to my problem.

原因

SharePoint更新删除了计算字段可以设置为我们的标记的功能,并且在

SharePoint update removed the ability of calculated fields to be set us markups and is explained in Handling HTML markup in SharePoint calculated fields.

解决方案

我找到了JSLink的解决方案.打开上面的链接后,有一些使用JSLink的示例.通过一些玩法,我设法实现了将计算所得的字段作为超链接.步骤很简单.

I have found a solution with JSLink. After opening link above, there are some examples using JSLink. With a bit of play-around, I managed to achieve having the calculated field as a hyperlink. The steps are simple.

  1. 使用代码创建js文件-在我的情况下,我创建了一个超链接,该超链接发布到具有当前项目值的另一个列表.

  1. Create a js file with code - in my case I create a hyperlink which posts to another list with values from current item.

复制js文件的链接位置.

Copy link location of js file.

视图中Web部件上的参考js文件,在其他"部分下.

Reference js file on web part on view, under section Miscellaneous.

Voila!

注意:在脚本中,字段名称必须是内部字段名称,这使我慢了很多.要获取内部字段名称,请打开列表设置,将鼠标悬停在所需字段上,然后在浏览器的左下方获得内部字段名称(此处为Field = Internal field name).

Note: in the script, the field name must be the internal field name, that slowed me down quite a bit. to get the internal field name, open list settings, hover over desired field and on the bottom left of your browser you get the internal field name (Field=Internal field name here).

JSExample可以在此处找到.

JSExample can be found here.

另一个有用的信息,请此处.

Another helpful read here.

这篇关于Sharepoint 2013计算字段作为超链接呈现为文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆