I created a sharepoint task list with the column "Priority" according to this guide: https://code.msdn.microsoft.com/office/Client-side-rendering-code-0a786cdd#content
Then I linked the JS, which I saved on m SharePoint under the "Miscellaneous" Part of the Web Part. Now, what the script is supposed to do, is to look for the column "priority" and replace the words "High" with a red png-picture, the words "normal" with a yellow png-picture etc...
However it seems like the JS is not working at all, because the list does not Change it appearence at all. I tried different approaches like, not replacing the words with Pictures and only changing their colours etc, however ist not working so far
Here is the full code:
(function () {
var priorityFiledContext = {};
priorityFiledContext.Templates = {};
priorityFiledContext.Templates.Fields = {
"Priority": { "View": priorityFiledTemplate }
};
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(priorityFiledContext);
})();
function priorityFiledTemplate(ctx) {
var priority = ctx.CurrentItem[ctx.CurrentFieldSchema.Name];
if(priority=="High") {
return "<img src='/sites/020014/Name/Biblio/AmpelRed.png'/>";
}
else if(priority=="Normal") {
return "<img src='/sites/020014/Name/Biblio/AmpelAmber.png'/>";
}
else if(priority=="Low") {
return "<img src='/sites/020014/Name/Biblio/AmpelGreen.png'/>";
}
}
now I am wondering, maybe this part of the code:
var priority = ctx.CurrentItem[ctx.CurrentFieldSchema.Name];
is supposed to find the "priority" coloumn, but im not sure, how it works...
thanks in advance!