Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix for weird look in list views #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 43 additions & 3 deletions Dev4Side.SP2013.FilteredLookup/FilteredLookupField.cs
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,47 @@ public override BaseFieldControl FieldRenderingControl {

return fieldControl;
}
}
#endregion
}
}
#endregion


#region fix for weird representation in list views
/// <summary>
/// The issue is described in many links such as
/// https://stackoverflow.com/questions/19954407/how-can-i-get-my-custom-field-type-lookup-to-render-in-list-view-on-sharepoint
/// and
/// https://social.msdn.microsoft.com/Forums/vstudio/en-US/1d01c560-c634-4320-80df-135bf9972536/custom-field-type-that-inherits-from-spfieldlookup?forum=sharepointdevelopment
/// The fix was taken from https://sptalks.wordpress.com/2014/04/17/custom-spfieldlookup-displaypattern-bug/
/// </summary>
public override string JSLink
{
get
{
if (CurrentControlMode == SPControlMode.Invalid || CurrentControlMode == SPControlMode.Display)
return "clienttemplates.js";

return base.JSLink;
}
set
{
base.JSLink = value;
}
}

public SPControlMode CurrentControlMode
{
get
{
try
{
return this.FieldRenderingControl.ControlMode;
}
catch
{
return SPControlMode.Invalid;
}
}
}
#endregion
}
}