Total Pageviews

9 Nov 2013

ShowField="NameWithPicture attribute breaks field rendering in SharePoint 2013

I've noticed that  ShowField="NameWithPicture" attribute  in SharePoint 2013 does not render properly:



So, instead of NameWithPicture value
<Field Name="Employee" ID="{33c2ee31-2927-4de3-8e7d-cc1f2676378b}" DisplayName="Сотрудник" Type="User" Required="TRUE" UserSelectionMode="PeopleOnly" UserSelectionScope="0" ShowField="NameWithPicture" /

you can use NameWithPictureAndDetails:
<Field Name="Employee" ID="{33c2ee31-2927-4de3-8e7d-cc1f2676378b}" DisplayName="Сотрудник" Type="User" Required="TRUE" UserSelectionMode="PeopleOnly" UserSelectionScope="0" ShowField="NameWithPictureAndDetails" />

The result should look simillar to:


I've also noticed, that you can also change the way user field is displayed. There is a number of ways this field can be rendered. Honestly, I had no idea you could do that!

Update (Solution #2):
Looks like after updating Visual Studio Projects from SP2010 to SP 2013 you can include <JSLink>clienttemplates.js</JSLink> node into your View in schema.xml:


This will allow you to render User field with  ShowField="NameWithPicture" properly.


3 comments:

  1. Hi, how about include this case to SPCAFContrib?

    ReplyDelete
  2. Hi, Dmitry! Yes, I'll be glad to contribute.

    ReplyDelete
    Replies
    1. Done
      https://spcafcontrib.codeplex.com/wikipage?title=CSC515106_NameWithPictureForUserField

      Delete