使用ctx.currentitem时,托管属性显示为未定义 [英] Managed properties appear as undefined while used using ctx.currentitem

查看:70
本文介绍了使用ctx.currentitem时,托管属性显示为未定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在自定义搜索结果Web部件中的悬停模板的显示模板.我可以使用ctx.CurrentItem.<托管属性名称>来显示几个属性.但有些属性虽然具有 价值观.我使用JavaScript警报检查过,它表明这些属性未定义.

I am customizing the display template of hover template in search result web part. I am able to display couple of properties using the ctx.CurrentItem.<managed property name> but there are a few properties which are not showing values though they have values. I checked using javascript alert and it shows that these properties are undefined.

在不同的情况下,我自定义了内容搜索Web部件的2行模板,使其成为6行模板.我在此模板中使用了相同的属性名称,并且可以正常工作.

In different scenario I customized the 2 lines template of content search web part to make it 6 lines template. I used the same property names in this template and it works.

知道我哪里出错了吗?

谢谢

Hemil

Hemil Damor

Hemil Damor

推荐答案

HI

使用以下方法进行验证

首先在页面中添加搜索结果Web部件.修改其属性以对所有项目使用特定的显示模板.将其设置为显示模板,然后根据模板查看其是否正在播放.

First of all add search result webpart in your page.Modify its properties to use the specific display templates for all items.Set it to your display template and see whether it is dsiplaying according to your template.

如果不检查显示模板.js文件的属性,则有一列称为托管属性映射.您要显示的属性是否存在于该集合中;如果没有,则需要通过html映射属性.

If not check the properties of display template .js files there is a column called managed property mapping.Is your property which you are trying to display is present in that collection.If not then you need to map the property through html.

第三次使用提琴手来验证它是否正在检索该属性及其获取的值为null或什么

Thirdly use fiddler to verify whether  it is retriving that property and its value it is getting is null or what


这篇关于使用ctx.currentitem时,托管属性显示为未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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