内容查询汇总不显示描述
我正在尝试为在 SharePoint 2010 中工作的内容查询汇总获取一些自定义视图。我制作了一个自定义新闻内容类型,其中包含一些基本列,例如标题、内容、评论和自定义列以切换在某个特定位置上显示它页面(布尔值/复选框)。
我编辑了 ItemStyle.xsl 并添加了一个包含标题、图像和描述的新视图类型。在 Web 部件的设置中(默认情况下),描述的值取自“注释”列。然而,描述从未显示出来,只是一个空的 div。
当我将自定义列添加到描述字段(以及注释列)时,会显示自定义列的值。我 100% 确定我的汇总中的所有新闻项目都有评论(甚至是必填字段)。但不知何故,无论我做什么,描述都不会显示。
我该如何调试这个?
I'm trying to get some custom views for a content query rollup working in SharePoint 2010. I've made a custom News content type with a few basic columns like title, contents, comments and a custom column to toggle showing it on a certain page (boolean/checkbox).
I've edited my ItemStyle.xsl and added a new view type that has a title, image and description. In the settings of the web part (by default) the value of the description is taken from the 'comments' column. However, the description never shows up, just an empty div.
When I added the custom column to the description field (along with the comments column) the value of the custom column was shown. I'm 100% certain all the news items in my rollup do have a comment (it's even a required field). Yet somehow whatever I do the description does not show up.
How do I go about debugging this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
问题可能是您的自定义列未传递到 XSL 中,因为它未包含在 CommonViewFields 中。您可以通过向 ItemStyle.xsl 添加这样的代码来验证这一点,该代码将回显它正在处理的所有底层 XML:(
我将 XML 放入文本区域,以便您可以看到它并复制它,而无需进入源代码)
如果您在 XML 中没有看到自定义列,则需要添加它。最简单的方法是在 SharePoint Designer 中修改内容查询 Web 部件的 CommonViewFields 属性,或者通过导出 Web 部件、编辑 .webpart 文件来修改,然后重新导入。
MSDN对此有一个很好的解释: http://msdn.microsoft.com /en-us/library/aa981241.aspx
The problem may be that your custom column is not being passed into your XSL because it is not included in the CommonViewFields. You can verify this by adding code like this to your ItemStyle.xsl which will echo out all of the underlying XML that it working on:
(I put the XML into a textarea so you can see it and copy it without going into the source)
If you do not see your custom column in the XML then you need to add it in. The simplest way is to modify the CommonViewFields property of the Content Query Web Part either in a SharePoint Designer or by exporting the webpart, editing the .webpart file, and then re-importing it.
There is a good explanation of this from MSDN: http://msdn.microsoft.com/en-us/library/aa981241.aspx
因此,显然“评论”字段是一个仅限后端的字段,用于向您要添加的任何页面添加一些描述。我正在寻找的是署名..很高兴有人终于能向我指出这一点。
So, apparently the Comments field is a backend-only field to add a little description to whatever page you're adding. What I was looking for was the byline.. Glad someone could finally point this out to me.