Hello,
ever tried to use custom field properties in rendering field content on a list view in sharepoint 2010? doesn't work..
so you google it (naturally) -
you hear about a magic way to deliver - CAMLRendering=TRUE, but hey - that doesn't work !!!
you go to msdn and find out that PropertySchema and RenderPattern are obsolete, but what is the way to do it in 2010, no one tells..
after a day of searching and wondering, i want to share my findings with you.
first of all, i still don't have a clue about how it suppose to be done in SharePoint 2010, but here's a working solution that will get you through meanwhile:
1. fldtypes_MyField.xml:
leave it as it was (or should be) for Moss 2007 - with rendering pattern and property schema, etc..
important: add the following properties AllowBaseTypeRendering & CAMLRendering !
for example:
<FieldTypes>
<FieldType>
<Field Name="TypeName">MyField</Field>
<Field Name="ParentType">Text</Field>
<Field Name="TypeDisplayName">TypeDisplayName;</Field>
<Field Name="TypeShortDescription">TypeDisplayName;</Field>
<Field Name="UserCreatable">TRUE</Field>
<Field Name="Sortable">TRUE</Field>
<Field Name="Filterable">TRUE</Field>
<Field Name="FieldTypeClass">MyField, MyField, Version=1.0.0.0, Culture=neutral, PublicKeyToken=...</Field>
<Field Name="FieldEditorUserControl">/_controltemplates/MyFieldFieldEditor.ascx</Field>
<Field Name="AllowBaseTypeRendering">TRUE</Field>
<Field Name="CAMLRendering">TRUE</Field>
<PropertySchema>
<Fields>
<Field Hidden="TRUE" Name="MyCustomProperty" DisplayName="MyCustomProperty" Type="Text">
</Field>
</Fields>
<Fields></Fields>
</PropertySchema>
<RenderPattern Name="HeaderPattern">
<HTML>
<![CDATA[
<script type="text/javascript" language="javascript" src="/_layouts/MyFieldHelper.js"></script>
]]>
</HTML>
<!-- copy the rest of the header pattern of base field -->
</RenderPattern>
<FieldType>
<Field Name="TypeName">MyField</Field>
<Field Name="ParentType">Text</Field>
<Field Name="TypeDisplayName">TypeDisplayName;</Field>
<Field Name="TypeShortDescription">TypeDisplayName;</Field>
<Field Name="UserCreatable">TRUE</Field>
<Field Name="Sortable">TRUE</Field>
<Field Name="Filterable">TRUE</Field>
<Field Name="FieldTypeClass">MyField, MyField, Version=1.0.0.0, Culture=neutral, PublicKeyToken=...</Field>
<Field Name="FieldEditorUserControl">/_controltemplates/MyFieldFieldEditor.ascx</Field>
<Field Name="AllowBaseTypeRendering">TRUE</Field>
<Field Name="CAMLRendering">TRUE</Field>
<PropertySchema>
<Fields>
<Field Hidden="TRUE" Name="MyCustomProperty" DisplayName="MyCustomProperty" Type="Text">
</Field>
</Fields>
<Fields></Fields>
</PropertySchema>
<RenderPattern Name="HeaderPattern">
<HTML>
<![CDATA[
<script type="text/javascript" language="javascript" src="/_layouts/MyFieldHelper.js"></script>
]]>
</HTML>
<!-- copy the rest of the header pattern of base field -->
</RenderPattern>
<RenderPattern Name="DisplayPattern">
<Switch>
<Expr>
<Property Select="MyCustomProperty" HTMLEncode="TRUE"/>
</Expr>
<Case Value="">
<Column HTMLEncode="TRUE"/>
</Case>
<Default>
<Property Select="MyCustomProperty" HTMLEncode="TRUE"/>
<!-- call js function inside HTML element, like in Moss -->
</Default>
</Switch>
</RenderPattern>
</FieldType>
</FieldTypes>
<Switch>
<Expr>
<Property Select="MyCustomProperty" HTMLEncode="TRUE"/>
</Expr>
<Case Value="">
<Column HTMLEncode="TRUE"/>
</Case>
<Default>
<Property Select="MyCustomProperty" HTMLEncode="TRUE"/>
<!-- call js function inside HTML element, like in Moss -->
</Default>
</Switch>
</RenderPattern>
</FieldType>
</FieldTypes>
2. fldtypes_MyField.xsl:
this one is new for SharePoint 2010, and it goes to Templates\Layouts\Xsl
in order to your js calls will be evaluated properly, you need these templates:
<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">
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[@FieldType='MyField']" mode="header">
<th class="ms-vh2" nowrap="nowrap" scope="col" onmouseover="OnChildColumn(this)">
<script language="Javascript" type="text/javascript" src="/_layouts/MyFieldHelper.js" />
<xsl:call-template name="dvt_headerfield">
<xsl:with-param name="fieldname">
<xsl:value-of select="@Name" />
</xsl:with-param>
<xsl:with-param name="fieldtitle">
<xsl:value-of select="@DisplayName" />
</xsl:with-param>
<xsl:with-param name="displayname">
<xsl:value-of select="@DisplayName" />
</xsl:with-param>
<xsl:with-param name="fieldtype">
<xsl:value-of select="@FieldType" />
</xsl:with-param>
</xsl:call-template>
</th>
</xsl:template>
<th class="ms-vh2" nowrap="nowrap" scope="col" onmouseover="OnChildColumn(this)">
<script language="Javascript" type="text/javascript" src="/_layouts/MyFieldHelper.js" />
<xsl:call-template name="dvt_headerfield">
<xsl:with-param name="fieldname">
<xsl:value-of select="@Name" />
</xsl:with-param>
<xsl:with-param name="fieldtitle">
<xsl:value-of select="@DisplayName" />
</xsl:with-param>
<xsl:with-param name="displayname">
<xsl:value-of select="@DisplayName" />
</xsl:with-param>
<xsl:with-param name="fieldtype">
<xsl:value-of select="@FieldType" />
</xsl:with-param>
</xsl:call-template>
</th>
</xsl:template>
<xsl:template match="FieldRef[@FieldType='MyField']" mode="body">
<xsl:param name="thisNode" select="." />
<xsl:value-of select="$thisNode/@*[name()=current()/@Name]" disable-output-escaping="yes" />
</xsl:template>
</xsl:stylesheet>
<xsl:param name="thisNode" select="." />
<xsl:value-of select="$thisNode/@*[name()=current()/@Name]" disable-output-escaping="yes" />
</xsl:template>
</xsl:stylesheet>
all other stuff - MyField, MyFieldEditor, Field Rendering Control, custom property storage work around all remains the same.
?
?happy coding,
?Genady
Loading...
Add your comment
Comments are not meant for support. If you experiencing an issue, please open a support request.
Reply to: from
WELCOME TO THE FUTURE
New faster ways for creating business solutions
ULTIMATEforms is a platform that enables everyone to easily create and maintain Microsoft SharePoint-based business solutions without a single line of code
Simple and Intuitive
Streamline form creation with smart, user-friendly tools
✓
Deploy smart dynamic forms that adapt to your business needs✓
Utilize a drag-and-drop interface for effortless form design✓
Experience rapid form customization with intuitive editing tools✓
Accelerate project timelines with user-friendly, immediate solutionsPowerful Automation
Enhance operational efficiency and compliance
✓
Streamline complex workflows into straightforward actions✓
Quickly establish compliant business processes✓
Seamlessly integrate data from diverse applications✓
Access and combine information easily for better decision-makingComprehensive Reporting
Transform data into actionable insights
✓
Generate detailed reports and dashboards for informed decision-making✓
Customize alerts and notifications to stay updated✓
Print and export data to PDF, Excel, or Word for easy sharing✓
Visualize data with color-coded calendars and intuitive dashboards100’s of Templates
Streamline form creation with smart, user-friendly tools
✓
Access hundreds of customizable templates for every business function✓
Install easily with one-time set-up; free for ULTIMATEFORMS customers✓
Replicate entire sites with settings between site collections and tenants using Template Manager✓
Jumpstart projects with pre-built solutions from our growing catalog, applied with a clickDive deeper
Watch a short introductory video showcasing the different unique capabilities of UltimateForms.