Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Rendering "People or Person" list column using CSR

$
0
0

Hi,

I am trying to render a Person/Group type list column using the code below

(function(){(window.jQuery || document.write('<script src="https://oursites.../jquery-1.11.3.js"><\/script>'));// Create object that have the context information about the field that we want to change it's output render var bodyFiledContext ={};
    bodyFiledContext.Templates={};
    bodyFiledContext.Templates.Fields={// Apply the new rendering for Body field on list view"Requestor_x0020_Name":{"View": bodyFiledTemplate }};SPClientTemplates.TemplateManager.RegisterTemplateOverrides(bodyFiledContext);})();// This function provides the rendering logicfunction bodyFiledTemplate(ctx){var bodyValue = ctx.CurrentItem[ctx.CurrentFieldSchema.Name];var regex =/(<([^>]+)>)/ig;
    bodyValue = bodyValue.replace("@thisdomain.com.au","");var newBodyValue = bodyValue;return"<span title='"+ bodyValue +"'>"+ newBodyValue +"</span>";}

But this code is not correct.

Has anyone seen any MS code snipperts that can be used to render this column type?

Thanks


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>