我有一个非常简单的BCS模型:

public Guid Id { get; set; }
public SPFieldUrlValue Url { get; set; }
public string Description { get; set; }
public string Owner { get; set; }
public DateTime CreatedOn { get; set; }

URL属性像任何SharePoint超链接属性一样包含标题和URL。 BCS模型具有以下类型描述符,用于读取列表和ReadItem方法:

<TypeDescriptor Name="Url" TypeName="Microsoft.SharePoint.SPFieldUrlValue">
    <Properties>
        <Property Name="SPCustomFieldType" Type="System.String">`URL</Property>
    </Properties>
</TypeDescriptor>

在列表定义的schema.xml中,我有以下字段集合的值:

<Field Name="BdcIdentity" DisplayName="BDC Identity" Hidden="FALSE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="BdcIdentity" Type="Text" />
<Field Name="Id" DisplayName="Id" Hidden="FALSE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Id" Type="Text" />
<Field Name="Url" DisplayName="Url" Format="Hyperlink" Hidden="FALSE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Url" Type="URL" />
<Field Name="Description" DisplayName="Description" Hidden="FALSE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Description" Type="Text" />
<Field Name="Owner" DisplayName="Owner" Hidden="FALSE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Owner" Type="Text" />
<Field Name="CreatedOn" DisplayName="Created On" Hidden="FALSE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="CreatedOn" Type="DateTime" />

没有什么太喜欢了。但是,当我打开默认视图时,它不会在表视图中正确显示URL - 它没有显示。在单个项目视图中,它确实正确显示。关于如何使Spfielidurlvalue正确地在UI上渲染的任何想法?

有帮助吗?

解决方案

两个半月后(!!!!)PSS能够使用自定义XML样式表进行解决方法,该样本将存储在balitouts/xsl中:

<xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" version="1.0" exclude-result-prefixes="xsl msxsl ddwrt" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:ddwrt2="urn:frontpage:internal">
  <xsl:template match="FieldRef[@Name='Url' and @Format='Hyperlink']" mode="URL_body" priority="1">
    <xsl:param name="thisNode" select="."/>
    <xsl:variable name="url" select="normalize-space(substring-before($thisNode/@*[name()=current()/@Name],','))" />
    <xsl:variable name="desc" select="normalize-space(substring-after($thisNode/@*[name()=current()/@Name],','))" />
    <xsl:variable name="descfld" select="$thisNode/@Description"/>
    <xsl:variable name="urlfld" select="$thisNode/@Url"/>
    <!--  URL: <xsl:value-of select="$urlfld" /><br/>
          Description: <xsl:value-of select="$descfld" /><br/>
      Link: -->
    <a href="{$url}" alt="{$desc}">
      <xsl:value-of select="$desc"/>
    </a>
  </xsl:template>
</xsl:stylesheet>

其他提示

根据MSDN页面 BDC自定义属性:

此属性对除具体源以外的方法没有影响。

我想知道,如何实现此XSL?奥斯科派对我可以创建它,并将其部署到布局/XSL ...但是外部列表与XSL文件之间没有连接吗?

许可以下: CC-BY-SA归因
scroll top