本文介绍了从搜索中的术语字段格式化多个值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

我有一个列表列,它是一个多值术语字段.

I have a list column which is a multiple value term field.

我创建了一个托管属性,并将其映射到该字段的ows_值.已启用此托管属性以处理多个值,因此应单独存储.

I have a managed property created and mapped to the ows_ value of this field. This managed property is enabled to handle multi values so it should store separately.

我的显示模板就是这样

text1,text2,text3

text1,text2,text3

我需要能够将每个术语单独列出,以便它看起来像这样

I need to be able to have each term listed as individually so it appears as this

text1

text2

text3

在这里,我需要添加一个< a href,以便每个值都是超链接,因此tostring().replace的所有javascript解决方案都不适合.我什至做了一个tostring().replace(/, /g,< br/&);;这将它们分开但仍然是一个字符串值.任何帮助 将不胜感激.

From here, I need to add a <a href so that each value is hyperlinks, so any javascript solutions to tostring().replace is not suitable. I even did a tostring().replace(/,/g,<br/>); which seperates them BUT its still one string value. Any help would be appreciated.

谢谢

推荐答案

我做了一个简单的测试,下面的代码供您参考:

I do a simple test, the code below for your reference:

<!--#_
var field="text1,text2,text3";
var array=field.split(",");
for(var i=0;i<array.length;i++){
_#-->
	<a href="#">_#= array[i]=#_</a><br>
<!--#_
}
_#-->

最好的问候,

丹尼斯


这篇关于从搜索中的术语字段格式化多个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 17:47