后台代码很简单,主要是XML要注意的,下面是列表XML的代码
<?xml version="1.0" encoding="utf-8"?> <FieldTypes> <FieldType> <Field Name="TypeName">SAGEURL</Field> <Field Name="ParentType">Text</Field> <Field Name="TypeDisplayName">SAGEURL</Field> <Field Name="TypeShortDescription">SAGEURL</Field> <Field Name="UserCreatable">TRUE</Field> <Field Name="ShowOnListCreate">TRUE</Field> <Field Name="ShowOnDocumentLibraryCreate">TRUE</Field> <Field Name="ShowOnSurveyCreate">TRUE</Field> <Field Name="ShowOnColumnTemplateCreate">TRUE</Field> <Field Name="FieldEditorUserControl"></Field> <Field Name="Sortable">TRUE</Field> <Field Name="Filterable">FALSE</Field> <Field Name="CAMLRendering">TRUE</Field> <Field Name="FieldTypeClass">SAGEFld_URL.SageURLfld,SAGEFld_URL, Version=1.0.0.0, Culture=neutral, PublicKeyToken=fb9892f1d2015318</Field> <PropertySchema> <Fields> <Field Name="SAGEURL" DisplayName="SAGEURL" MaxLength="300" DisplaySize="30" Type="Text" Hidden="TRUE" > </Field> </Fields> </PropertySchema> <RenderPattern Name="DisplayPattern"> <HTML><![CDATA[<a href='/_layouts/SAGE/OA/WorkflowUser.aspx?ID=]]></HTML> <Field Name="ID" /> <HTML><![CDATA['>]]></HTML> <HTML><![CDATA[打开文档]]></HTML> <HTML><![CDATA[</a>]]></HTML> </RenderPattern> </FieldType>
特别注意要加上:
<Field Name="CAMLRendering">TRUE</Field>
如果没有加上,在显示视图上没有效果的。
2. 在自定义字段开发的时候,开发一个超链接字段的时候,想在其后面的把列表项中某一个字段的值带过去,下面是其作法。
注意:这个字段需在视图里显示才会有用
<?xml version="1.0" encoding="utf-8"?> <FieldTypes> <FieldType> <FieldRefs> <FieldRef Name="ID"/> <FieldRef Name="CustomColumm"/> </FieldRefs> <Field Name="TypeName">HightLightFieldrece</Field> <Field Name="ParentType">Text</Field> <Field Name="TypeDisplayName">启动工作流meet</Field> <Field Name="TypeShortDescription">启动工作流meet</Field> <Field Name="UserCreatable">TRUE</Field> <Field Name="ShowInListCreate">FALSE</Field> <Field Name="ShowInSurveyCreate">FALSE</Field> <Field Name="ShowInDocumentLibraryCreate">FALSE</Field> <Field Name="ShowInColumnTemplateCreate">FALSE</Field> <Field Name="CAMLRendering">TRUE</Field> <Field Name="FieldTypeClass">HighLight.HighLightField,HighLightField, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9f4da00116c38ec5</Field> <RenderPattern Name="DisplayPattern"> <HTML><![CDATA[<a target="_blank" href="/meet/_layouts/OA/WorkflowUser.aspx?ID=]]></HTML> <Field Name="ID" /> <HTML><![CDATA[&List=]]></HTML> <Field Name="CustomColumm" /> <HTML><![CDATA[">Sart</a>]]></HTML> </RenderPattern> </FieldType> </FieldTypes>