开发者

Sharepoint - change way of displaying a field on a list

开发者 https://www.devze.com 2023-04-03 06:13 出处:网络
I have a sharepoint list that contains a multiple lookup field. I would like to change the way its values are disp开发者_如何学Clayed (normaly you get links to chosen items like item1;item2;item3), so

I have a sharepoint list that contains a multiple lookup field. I would like to change the way its values are disp开发者_如何学Clayed (normaly you get links to chosen items like item1;item2;item3), so that I could for instance construct my own link to redirect me to the source list filtered by items chosen on this lookup.

I try to do that by creating a custom field by that is inheriting SPFieldLookup, but i'm a bit stuck since I can't don't know which method/property to override to change what is being displayed (if this is possible at all). Any help would be appreciated


I'd create a custom field type that inherits from SPFieldLookup. But instead of do the rendering server side I'd use a XSTL to render the field:

How to: Customize the Rendering of a Field on a List View

This way you do not have to implement a custom SPField class at all. You just have to create a custom field type definition that points to the OOTB SPLookupField.

<?xml version="1.0" encoding="utf-8" ?>
<FieldTypes>
    <FieldType>
        <Field Name="TypeName">CustomLookupField</Field>
        <Field Name="TypeDisplayName">Custom Lookup Field</Field>
        <Field Name="TypeShortDescription">Custom Lookup Field</Field>
        <Field Name="FieldTypeClass">Microsoft.SharePoint.SPFieldLookup</Field>
        <Field Name="ParentType">Lookup</Field>
    </FieldType>
</FieldTypes>
0

精彩评论

暂无评论...
验证码 换一张
取 消