Problem with DisplayPattern in SharePoint 2010?

I am adding a new field to the list using the AddFieldAsXML method for SPFieldCollection. The method works fine without problems. The column heading is displayed when I view the list; however, the value is never displayed in the column. This is how the field looks after adding to the list. This xml is a break from the list schema obtained using http: // tw-s1-m4400-007: 4016 / _vti_bin / owssvr.dll? Cmd = ExportList & List = {1F87433F-50E1-46C5-A138-00E1CF7E5801}

This code works fine in 2007, but doesn't work in 2010. Any help would be appreciated.

<Field ID="{e24ccb96-35fd-44e5-b7d1-4150dbbc9a64}" Type="Computed" ReadOnly="TRUE"
   Name="My_x0020_Status" DisplayName="MyStatus" ShowInEditForm="TRUE" ClassInfo="Icon"   
AuthoringInfo="(My status)" SourceID="http://schemas.microsoft.com/sharepoint/v3"       
StaticName="MyStatus" FromBaseType="TRUE">  
 <FieldRefs>
  <FieldRef Name="ID" /> 
  <FieldRef Name="Title" /> 
 </FieldRefs>
 <DisplayPattern>
 <HTML>
 <![CDATA[ <a href="form.htm?ID="
  ]]> 
  </HTML>
  <Column Name="ID" /> 
 <HTML>
 <![CDATA[ ">
  ]]> 
  </HTML>
  <Column Name="Title" /> 
 <HTML>
 <![CDATA[ </a>
  ]]> 
  </HTML>
  </DisplayPattern>
</Field>
+3
source share
4 answers

This link was of great help in solving this problem:

http://social.technet.microsoft.com/Forums/en/sharepoint2010customization/thread/ef0d1d22-47ff-416c-becd-13d48de80e4d

, C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\XSL\fldtypes.xsl.

fldtypes_ratings.xsl, .

xsl (, fldtypes_myfile.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" ns: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='MyCustomField']" mode="Computed_body">
    <xsl:param name="thisNode" select="."/>
      <SPAN class="mystuff-content-item" style="Width:100%;text-align:center">
          <SPAN class='mystuff-socialized-status mystuff-socialized-status-unknown'></SPAN>
          <SPAN class="mystuff-content-object-type" style="display:none">
               MyContent
          </SPAN>
          <SPAN class="mystuff-content-followed" style="display:none">0</SPAN>
          <SPAN class="mystuff-content-name" style="display:none"></SPAN>
          <SPAN class="mystuff-content-id" style="display:none">
            <xsl:value-of select="$List" />
            <xsl:text>|</xsl:text>
            <xsl:value-of select="$thisNode/@ID" />
          </SPAN>
      </SPAN>
    </xsl:template>

</xsl:stylesheet>

, !

+2

- : " , SharePoint Foundation, DisplayPattern RenderPattern FLDTYPES.XML: (1) ContentTypeId (2) DisplayPattern schema.xml , ."

"", , , fldttypes.xml renderpattern, intstead DisplayPattern , . , DisplayPattern 2010 - , , , .

+1

2007 - 2010 . SDK- RenderPattern:

! , , , . , , SharePoint Foundation. . . . . , RenderPattern, - . SharePoint Foundation XSLT , , RenderPattern. , TRUE FieldTypes (fldtype *.xml).

0
source

Source: https://habr.com/ru/post/1735154/


All Articles