I'm totally at wits end here. I am trying to use CSR to display custom html depending on a "case status" column.
I've added the JS file to the masterpage folder and used the JS Link to connect it. No matter how much i simplify the code or where I put it ( I even tried in a CEWP) absolutely nothing changes! A simplified version worked on my test site, but now I can no longer replicate there either.
I am clearly missing something major, please help
var Lifeline = Lifeline || {};
Lifeline.Templates = Lifeline.Templates || {};
Lifeline.Functions = Lifeline.Functions || {};
Lifeline.Templates.Fields = {
"Case Status": {"View": Lifeline.Functions.statusViewFormat}
};
Lifeline.Functions.statusViewFormat = function(ctx){
var caseStatusValue = ctx.CurrentItem.Case_x0020_Status;
var caseStatusIcon;
switch (caseStatusValue){
case "New":
caseStatusIcon = "<span class='tooltip'><i class='fa fa-circle fa-lg' aria-hidden='true' style='color\\: #4da6ff;'></i><span class='tooltiptext'>"+caseStatusValue+"</span></span>";
break;
case "Available":
caseStatusIcon = "<span class='tooltip'><i class='fa fa-circle-o fa-lg' style='color: #bb99ff;'></i><span class='tooltiptext'>"+caseStatusValue+"</span></span>";
break;
case "In Progress":
caseStatusIcon = "<span class='tooltip'><i class='fa fa-circle fa-lg' style='color: #bb99ff;'></i><span class='tooltiptext'>"+caseStatusValue+"</span></span>";
break;
case "Awaiting Approval":
caseStatusIcon = "<span class='tooltip'><i class='fa fa-clock-o fa-lg' style='color: #ffcc00;'></i><span class='tooltiptext'>"+caseStatusValue+"</span></span>";
break;
case "Needs Review":
caseStatusIcon = "<span class='tooltip'><i class='fa fa-minus-circle fa-lg' style='color: #ff4d4d;'></i><span class='tooltiptext'>"+caseStatusValue+"</span></span>";
break;
case "Completed":
caseStatusIcon = "<span class='tooltip'><i class='fa fa-check-circle fa-lg' style='color: #32cd32;'></i><span class='tooltiptext'>"+caseStatusValue+"</span></span>";
break;
case "Closed":
caseStatusIcon = "<span class='tooltip'><i class='fa fa-check-circle fa-lg' style='color: #bfbfbf;'></i><span class='tooltiptext'>"+caseStatusValue+"</span></span>"
}
return caseStatusIcon;
};
// Registering Functions and Starting
if (typeof _spPageContextInfo != "undefined" && _spPageContextInfo != null) {
Lifeline.Functions.MdsRegisterField();
} else {
//MDS is not activated, we register our Functions
Lifeline.Functions.RegisterField();
}
Lifeline.Functions.MdsRegisterField = function(){
var thisUrl = _spPageContextInfo.siteServerRelativeUrl+"/_catalogs/masterpage/Display Templates/casemanageui.js";
Lifeline.Functions.RegisterField();
//Important step when MDS is active
RegisterModuleInit(thisUrl, Lifeline.Functions.RegisterField)
};
Lifeline.Functions.RegisterField = function(){
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(Lifeline)
};