SharePoint 2007 Custom field rendering at List Item View is done through the CAML code. In the custom field definition XML file, there is a section where display is defined... and that is within the <RenderPattern>. Usually you can access the filed properties in the filed through simple CAML code. For an instance:
<RenderPattern Name="DisplayPattern">
<HTML><![CDATA[</div><br/><br/><div>Name Value:</div><br/>]]></HTML>
<ScriptQuote>
<Property Select="Name" HTMLEncode="True" />
</ScriptQuote>
<HTML><![CDATA[<div>Custom Property 1 Value</div><br/>]]></HTML>
<ScriptQuote>
<Property Select="MyCustomProperty1" HTMLEncode="True" />
</ScriptQuote>
<HTML><![CDATA[<div>Custom Property 2 Value</div><br/>]]></HTML>
<ScriptQuote>
<Property Select="MyCustomProperty2" HTMLEncode="True" />
</ScriptQuote>
<HTML><![CDATA[<div>Description : </div><br/>]]></HTML>
<ScriptQuote>
<Property Select="Description" HTMLEncode="True" />
</ScriptQuote>
<HTML><![CDATA[<div>Required : </div><br/>]]></HTML>
<ScriptQuote>
<Property Select="Required" HTMLEncode="True" />
</ScriptQuote>
<Column HTMLEncode="TRUE"/>
</RenderPattern>
It is possible to get the custom property values and display at DisplayPattern. For this it's required that the property schema's being updated during the field's onAdd() and onUpdate() methods. Solution s to override the two methods.
Then the custom property values become accessible.
<RenderPattern Name="DisplayPattern">
<HTML><![CDATA[</div><br/><br/><div>Name Value:</div><br/>]]></HTML>
<ScriptQuote>
<Property Select="Name" HTMLEncode="True" />
</ScriptQuote>
<HTML><![CDATA[<div>Custom Property 1 Value</div><br/>]]></HTML>
<ScriptQuote>
<Property Select="MyCustomProperty1" HTMLEncode="True" />
</ScriptQuote>
<HTML><![CDATA[<div>Custom Property 2 Value</div><br/>]]></HTML>
<ScriptQuote>
<Property Select="MyCustomProperty2" HTMLEncode="True" />
</ScriptQuote>
<HTML><![CDATA[<div>Description : </div><br/>]]></HTML>
<ScriptQuote>
<Property Select="Description" HTMLEncode="True" />
</ScriptQuote>
<HTML><![CDATA[<div>Required : </div><br/>]]></HTML>
<ScriptQuote>
<Property Select="Required" HTMLEncode="True" />
</ScriptQuote>
<Column HTMLEncode="TRUE"/>
</RenderPattern>
The code would give you the property values of the Description, the required field value and Name value. But.....not the values of the custom properties in your field......
It is possible to get the custom property values and display at DisplayPattern. For this it's required that the property schema's being updated during the field's onAdd() and onUpdate() methods. Solution s to override the two methods.
Then the custom property values become accessible.
A detailed explanation is available at this Link.
No comments:
Post a Comment