Answered by:
Filter by Person in a DataView Webpart

Question
-
I am trying to Filter Items in a Data View webpart using my Assigned To(Person or Group field) But the Values in my Dropdown has HTML in it.
I had the same issue when displaying Items in Webpart and Fixed it replacing Filed with <xsl:value-of select="@AssignedTo" disable-output-escaping="yes" /> But Don't know How to change it in Filter Choice values .....
- Edited by Siva Chundru Friday, May 14, 2010 5:18 AM
Friday, May 14, 2010 12:28 AM
Answers
-
Sorry, I missed that. As I explain in the blog post, Person or Group columns are problematic. You're going to need to dig into the XSL to customize it. It's not just choosing the value that you'll have problems with; you'll also have to adapt the filtering logic.
M.
Sympraxis Consulting LLC - Marc D Anderson's Blog - @sympmarc - jQuery Library for SharePoint Web Services (SPServices) - Unlocking the Mysteries of the SharePoint Data View Web Part XSL Tags eBook- Marked as answer by Lambert Qin [秦磊] Thursday, May 20, 2010 8:24 AM
Friday, May 14, 2010 2:29 PM
All replies
-
Displaying the value correctly is a simple matter of adding the disable-output-escaping="yes" attribute.
Person or Group columns are more complicated when it comes to sorting or grouping. See my blog post:
http://mdasblog.wordpress.com/2010/03/02/unlocking-the-mysteries-of-data-view-web-part-xsl-tags-part-12-miscellaneous-person-or-group-columns/M.
Sympraxis Consulting LLC - Marc D Anderson's Blog - @sympmarc - jQuery Library for SharePoint Web Services (SPServices) - Unlocking the Mysteries of the SharePoint Data View Web Part XSL Tags eBookFriday, May 14, 2010 3:44 AM -
Marc, I am having trouble showing person in field filter choices but not in list data I know adding disable output escape value to yes can correct this but where to add it to changes values in filter values as shown in figure( not in list item value )Friday, May 14, 2010 5:39 AM
-
Sorry, I missed that. As I explain in the blog post, Person or Group columns are problematic. You're going to need to dig into the XSL to customize it. It's not just choosing the value that you'll have problems with; you'll also have to adapt the filtering logic.
M.
Sympraxis Consulting LLC - Marc D Anderson's Blog - @sympmarc - jQuery Library for SharePoint Web Services (SPServices) - Unlocking the Mysteries of the SharePoint Data View Web Part XSL Tags eBook- Marked as answer by Lambert Qin [秦磊] Thursday, May 20, 2010 8:24 AM
Friday, May 14, 2010 2:29 PM -
I'm having the same problem. Can't get the filter to show just the name and not the HTML. Tried substringing but that did not work. Do you have the actual xsl code to fix this standard issue?
Tuesday, November 20, 2012 12:06 PM -
Substringing out the ID or name will work. Check out my SPXSLT Codeplex Project for templates you can use.
M.
Sympraxis Consulting LLC - Marc D Anderson's Blog - @sympmarc - jQuery Library for SharePoint Web Services (SPServices)
Tuesday, November 20, 2012 1:02 PM -
Hi Marc,
Forgive an XSL newbie but if I used your code for Strip HTML where would the call to the template go?
I have my filters set up in the top row of my columns. Current code is something like this:
<th class="ms-vh" nowrap"">
<xsl:call-template name="dvt.headerfield"ddwt:atomic="1" xmlns:ddwrt="http://schemas.microsoft.....
<xsl:with-param name="fieldname">@AssignedTo</xsl:with-param>
<xsl:with-param name="fieldtitle">Activity POC</xsl:with-param>
<xsl:with-param name="displayname">Activity POC</xsl:with-param>
<xsl:with-param name="dvt_sorttype">text</xsl:with-param>
<xsl:with-param name="sortable">1</xsl:with-param>
<xsl:with-param name="fieldtype">x:string</xsl:with-param>
</xsl:call-template>
</th>
The value code in the DVWP dvt_1.rowview template is:
<xsl:value-of select="@AssignedTo" disable-output-escaping="yes"/>
would I place you code after the </xsl:template> tag?
- Edited by Blue Mountain Wolf Tuesday, November 20, 2012 3:34 PM
Tuesday, November 20, 2012 3:09 PM -
I think you probably want one of the templates that strips values out of Person or Group columns, not this one.
There are general instructions in the documentation on the site.
M.
Sympraxis Consulting LLC - Marc D Anderson's Blog - @sympmarc - jQuery Library for SharePoint Web Services (SPServices)
Tuesday, November 20, 2012 7:56 PM -
Hi,
I understand how to substring out my value so that just the person info shows up in a column. But how do you fix the filter???????????? This seems to be a major problem for all? Here is the filter code in the column heading:
<xsl:call-template name="dvt.headerfield" ddwrt:atomic="1" xmlns:ddwrt="schemas.microsoft.com/WebParts/v2/DataView/runtime"> <xsl:with-param name="fieldname">@AssignedTo</xsl:with-param> <xsl:with-param name="fieldtitle">AssignedTo</xsl:with-param> <xsl:with-param name="displayname">Assigned To</xsl:with-param> <xsl:with-param name="dvt_sorttype">text</xsl:with-param> <xsl:with-param name="sortable">1</xsl:with-param> <xsl:with-param name="fieldtype">x:string</xsl:with-param> </xsl:call-template>
Do I modify one of theses rows or am I in the wrong place?
- Edited by Blue Mountain Wolf Wednesday, November 28, 2012 12:35 PM
Tuesday, November 27, 2012 1:27 PM -
Hey @TLunn,
I also got same problem when we have upgraded from SP2010 to 2013. So, I have poked around XSLT and Rich fields for couple of days. Finally, I figured out a way to solve the issue. Basically, you just need to grab the values from rich text field properties like @AssignedTo.title, @AssignedTo.email etc. In my case, I had to show user name from People field. So I have changed my header field XSLT as below. Rich Text fileds like People and URL, returns few extra attributes like User ID, Title, URL to display profile, SIP ID, email. When you convert those all atributes into string, it returns chunck of HTML and it shows up in filter. So, get the exact value whatever you want (if you still have this issue :P ) from rich text field properties. In your case it should be <xsl:with-param name="fieldtitle">AssignedTo.title</xsl:with-param>. I hope this helps you to resolve your issue
<xsl:call-template name="dvt.headerfield" ddwrt:atomic="1" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime">
<xsl:with-param name="fieldname">@Assigned_x0020_Writer.title</xsl:with-param>
<xsl:with-param name="fieldtitle">Internal Writer</xsl:with-param>
<xsl:with-param name="displayname">Internal Writer</xsl:with-param>
<xsl:with-param name="sortable">1</xsl:with-param>
<xsl:with-param name="fieldtype">x:string</xsl:with-param>
</xsl:call-template>
Thursday, March 28, 2013 10:40 PM