4 added 347 characters in body
source | link

I have 3 columns:

  • InorOut
  • In (calculated field)
  • Out (calculated field)

The In and Out columns displays the icon using this formula:

="<DIV style='text-align:center'>"&IF([In or Out]="In","<img src='/_layouts/images/KPIDefault-0.GIF' align='middle'>","")&"</DIV>"

I also set the return data type to number. It was working for months until today. I took a screenshot yesterday so I know it was working: enter image description here

Today, it displays the code instead of the icons. Any idea how to fix this or maybe another way to display status icons? I found and tried Status Indicators on SharePoint Online but it didn't work or I wasn't doing it right.

Below is the js code I'm using:

(function() {
var oFldCtx = {};
oFldCtx.Templates = {};
oFldCtx.Templates.Fields = {"InorOut": {"View": overrideStatus} };
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(oFldCtx);
})();
function overrideStatus(ctx) {
var sStatus = ctx.CurrentItem.InorOut;
var sIconFileName = "";
switch(sStatus) {
    case "In":
            sIconFileName = "KPIDefault-0.GIF";
        break;
    case "Out":
            sIconFileName = "KPIDefault-2.GIF";
        break;
    default:
        break;
}
if (sIconFileName == "") return sStatus;
var sWebURL = _spPageContextInfo.webServerRelativeUrl;
var sIconSrc = sWebUrl + "/_catalogs/masterpage/DS/icons/" + sIconFileName;
var sImgTag = "<img id='" + ctx.CurrentItem.ID + "' ";
sImgTag += "src='" + sIconSrc + "' ";
sImgTag += "/>";
return sImgTag;
}

Resolution: Fixed the typo (WebURL vs. WebUrl) in the above code

The js file is not loading (404), below is the js file properties -- did I set it incorrectly? enter image description here

Resolution: I learned more about the js properties by reading this link. The article also explained more about the usage of ~site and ~sitecollection in the JS Link I initially didn't understand

Thanks for all the help.

I have 3 columns:

  • InorOut
  • In (calculated field)
  • Out (calculated field)

The In and Out columns displays the icon using this formula:

="<DIV style='text-align:center'>"&IF([In or Out]="In","<img src='/_layouts/images/KPIDefault-0.GIF' align='middle'>","")&"</DIV>"

I also set the return data type to number. It was working for months until today. I took a screenshot yesterday so I know it was working: enter image description here

Today, it displays the code instead of the icons. Any idea how to fix this or maybe another way to display status icons? I found and tried Status Indicators on SharePoint Online but it didn't work or I wasn't doing it right.

Below is the js code I'm using:

(function() {
var oFldCtx = {};
oFldCtx.Templates = {};
oFldCtx.Templates.Fields = {"InorOut": {"View": overrideStatus} };
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(oFldCtx);
})();
function overrideStatus(ctx) {
var sStatus = ctx.CurrentItem.InorOut;
var sIconFileName = "";
switch(sStatus) {
    case "In":
            sIconFileName = "KPIDefault-0.GIF";
        break;
    case "Out":
            sIconFileName = "KPIDefault-2.GIF";
        break;
    default:
        break;
}
if (sIconFileName == "") return sStatus;
var sWebURL = _spPageContextInfo.webServerRelativeUrl;
var sIconSrc = sWebUrl + "/_catalogs/masterpage/DS/icons/" + sIconFileName;
var sImgTag = "<img id='" + ctx.CurrentItem.ID + "' ";
sImgTag += "src='" + sIconSrc + "' ";
sImgTag += "/>";
return sImgTag;
}

The js file is not loading (404), below is the js file properties -- did I set it incorrectly? enter image description here

Thanks for all the help.

I have 3 columns:

  • InorOut
  • In (calculated field)
  • Out (calculated field)

The In and Out columns displays the icon using this formula:

="<DIV style='text-align:center'>"&IF([In or Out]="In","<img src='/_layouts/images/KPIDefault-0.GIF' align='middle'>","")&"</DIV>"

I also set the return data type to number. It was working for months until today. I took a screenshot yesterday so I know it was working: enter image description here

Today, it displays the code instead of the icons. Any idea how to fix this or maybe another way to display status icons? I found and tried Status Indicators on SharePoint Online but it didn't work or I wasn't doing it right.

Below is the js code I'm using:

(function() {
var oFldCtx = {};
oFldCtx.Templates = {};
oFldCtx.Templates.Fields = {"InorOut": {"View": overrideStatus} };
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(oFldCtx);
})();
function overrideStatus(ctx) {
var sStatus = ctx.CurrentItem.InorOut;
var sIconFileName = "";
switch(sStatus) {
    case "In":
            sIconFileName = "KPIDefault-0.GIF";
        break;
    case "Out":
            sIconFileName = "KPIDefault-2.GIF";
        break;
    default:
        break;
}
if (sIconFileName == "") return sStatus;
var sWebURL = _spPageContextInfo.webServerRelativeUrl;
var sIconSrc = sWebUrl + "/_catalogs/masterpage/DS/icons/" + sIconFileName;
var sImgTag = "<img id='" + ctx.CurrentItem.ID + "' ";
sImgTag += "src='" + sIconSrc + "' ";
sImgTag += "/>";
return sImgTag;
}

Resolution: Fixed the typo (WebURL vs. WebUrl) in the above code

The js file is not loading (404), below is the js file properties -- did I set it incorrectly? enter image description here

Resolution: I learned more about the js properties by reading this link. The article also explained more about the usage of ~site and ~sitecollection in the JS Link I initially didn't understand

Thanks for all the help.

3 added image
source | link

I have 3 columns:

  • InorOut
  • In (calculated field)
  • Out (calculated field)

The In and Out columns displays the icon using this formula:

="<DIV style='text-align:center'>"&IF([In or Out]="In","<img src='/_layouts/images/KPIDefault-0.GIF' align='middle'>","")&"</DIV>"

I also set the return data type to number. It was working for months until today. I took a screenshot yesterday so I know it was working: enter image description here

Today, it displays the code instead of the icons. Any idea how to fix this or maybe another way to display status icons? I found and tried Status Indicators on SharePoint Online but it didn't work or I wasn't doing it right.

Below is the js code I'm using:

(function() {
var oFldCtx = {};
oFldCtx.Templates = {};
oFldCtx.Templates.Fields = {"InorOut": {"View": overrideStatus} };
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(oFldCtx);
})();
function overrideStatus(ctx) {
var sStatus = ctx.CurrentItem.InorOut;
var sIconFileName = "";
switch(sStatus) {
    case "In":
            sIconFileName = "KPIDefault-0.GIF";
        break;
    case "Out":
            sIconFileName = "KPIDefault-2.GIF";
        break;
    default:
        break;
}
if (sIconFileName == "") return sStatus;
var sWebURL = _spPageContextInfo.webServerRelativeUrl;
var sIconSrc = sWebUrl + "/_catalogs/masterpage/DS/icons/" + sIconFileName;
var sImgTag = "<img id='" + ctx.CurrentItem.ID + "' ";
sImgTag += "src='" + sIconSrc + "' ";
sImgTag += "/>";
return sImgTag;
}

The js file is not loading (404), below is the js file properties -- did I set it incorrectly? enter image description here

Thanks for all the help.

I have 3 columns:

  • InorOut
  • In (calculated field)
  • Out (calculated field)

The In and Out columns displays the icon using this formula:

="<DIV style='text-align:center'>"&IF([In or Out]="In","<img src='/_layouts/images/KPIDefault-0.GIF' align='middle'>","")&"</DIV>"

I also set the return data type to number. It was working for months until today. I took a screenshot yesterday so I know it was working: enter image description here

Today, it displays the code instead of the icons. Any idea how to fix this or maybe another way to display status icons? I found and tried Status Indicators on SharePoint Online but it didn't work or I wasn't doing it right.

Below is the js code I'm using:

(function() {
var oFldCtx = {};
oFldCtx.Templates = {};
oFldCtx.Templates.Fields = {"InorOut": {"View": overrideStatus} };
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(oFldCtx);
})();
function overrideStatus(ctx) {
var sStatus = ctx.CurrentItem.InorOut;
var sIconFileName = "";
switch(sStatus) {
    case "In":
            sIconFileName = "KPIDefault-0.GIF";
        break;
    case "Out":
            sIconFileName = "KPIDefault-2.GIF";
        break;
    default:
        break;
}
if (sIconFileName == "") return sStatus;
var sWebURL = _spPageContextInfo.webServerRelativeUrl;
var sIconSrc = sWebUrl + "/_catalogs/masterpage/DS/icons/" + sIconFileName;
var sImgTag = "<img id='" + ctx.CurrentItem.ID + "' ";
sImgTag += "src='" + sIconSrc + "' ";
sImgTag += "/>";
return sImgTag;
}

I have 3 columns:

  • InorOut
  • In (calculated field)
  • Out (calculated field)

The In and Out columns displays the icon using this formula:

="<DIV style='text-align:center'>"&IF([In or Out]="In","<img src='/_layouts/images/KPIDefault-0.GIF' align='middle'>","")&"</DIV>"

I also set the return data type to number. It was working for months until today. I took a screenshot yesterday so I know it was working: enter image description here

Today, it displays the code instead of the icons. Any idea how to fix this or maybe another way to display status icons? I found and tried Status Indicators on SharePoint Online but it didn't work or I wasn't doing it right.

Below is the js code I'm using:

(function() {
var oFldCtx = {};
oFldCtx.Templates = {};
oFldCtx.Templates.Fields = {"InorOut": {"View": overrideStatus} };
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(oFldCtx);
})();
function overrideStatus(ctx) {
var sStatus = ctx.CurrentItem.InorOut;
var sIconFileName = "";
switch(sStatus) {
    case "In":
            sIconFileName = "KPIDefault-0.GIF";
        break;
    case "Out":
            sIconFileName = "KPIDefault-2.GIF";
        break;
    default:
        break;
}
if (sIconFileName == "") return sStatus;
var sWebURL = _spPageContextInfo.webServerRelativeUrl;
var sIconSrc = sWebUrl + "/_catalogs/masterpage/DS/icons/" + sIconFileName;
var sImgTag = "<img id='" + ctx.CurrentItem.ID + "' ";
sImgTag += "src='" + sIconSrc + "' ";
sImgTag += "/>";
return sImgTag;
}

The js file is not loading (404), below is the js file properties -- did I set it incorrectly? enter image description here

Thanks for all the help.

2 add code
source | link

I have 3 columns:

  • InorOut
  • In (calculated field)
  • Out (calculated field)

The In and Out columns displays the icon using this formula:

="<DIV style='text-align:center'>"&IF([In or Out]="In","<img src='/_layouts/images/KPIDefault-0.GIF' align='middle'>","")&"</DIV>"

I also set the return data type to number. It was working for months until today. I took a screenshot yesterday so I know it was working: enter image description here

Today, it displays the code instead of the icons. Any idea how to fix this or maybe another way to display status icons? I found and tried Status Indicators on SharePoint Online but it didn't work or I wasn't doing it right.

Below is the js code I'm using:

(function() {
var oFldCtx = {};
oFldCtx.Templates = {};
oFldCtx.Templates.Fields = {"InorOut": {"View": overrideStatus} };
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(oFldCtx);
})();
function overrideStatus(ctx) {
var sStatus = ctx.CurrentItem.InorOut;
var sIconFileName = "";
switch(sStatus) {
    case "In":
            sIconFileName = "KPIDefault-0.GIF";
        break;
    case "Out":
            sIconFileName = "KPIDefault-2.GIF";
        break;
    default:
        break;
}
if (sIconFileName == "") return sStatus;
var sWebURL = _spPageContextInfo.webServerRelativeUrl;
var sIconSrc = sWebUrl + "/_catalogs/masterpage/DS/icons/" + sIconFileName;
var sImgTag = "<img id='" + ctx.CurrentItem.ID + "' ";
sImgTag += "src='" + sIconSrc + "' ";
sImgTag += "/>";
return sImgTag;
}

I have 3 columns:

  • InorOut
  • In (calculated field)
  • Out (calculated field)

The In and Out columns displays the icon using this formula:

="<DIV style='text-align:center'>"&IF([In or Out]="In","<img src='/_layouts/images/KPIDefault-0.GIF' align='middle'>","")&"</DIV>"

I also set the return data type to number. It was working for months until today. I took a screenshot yesterday so I know it was working: enter image description here

Today, it displays the code instead of the icons. Any idea how to fix this or maybe another way to display status icons? I found and tried Status Indicators on SharePoint Online but it didn't work or I wasn't doing it right.

I have 3 columns:

  • InorOut
  • In (calculated field)
  • Out (calculated field)

The In and Out columns displays the icon using this formula:

="<DIV style='text-align:center'>"&IF([In or Out]="In","<img src='/_layouts/images/KPIDefault-0.GIF' align='middle'>","")&"</DIV>"

I also set the return data type to number. It was working for months until today. I took a screenshot yesterday so I know it was working: enter image description here

Today, it displays the code instead of the icons. Any idea how to fix this or maybe another way to display status icons? I found and tried Status Indicators on SharePoint Online but it didn't work or I wasn't doing it right.

Below is the js code I'm using:

(function() {
var oFldCtx = {};
oFldCtx.Templates = {};
oFldCtx.Templates.Fields = {"InorOut": {"View": overrideStatus} };
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(oFldCtx);
})();
function overrideStatus(ctx) {
var sStatus = ctx.CurrentItem.InorOut;
var sIconFileName = "";
switch(sStatus) {
    case "In":
            sIconFileName = "KPIDefault-0.GIF";
        break;
    case "Out":
            sIconFileName = "KPIDefault-2.GIF";
        break;
    default:
        break;
}
if (sIconFileName == "") return sStatus;
var sWebURL = _spPageContextInfo.webServerRelativeUrl;
var sIconSrc = sWebUrl + "/_catalogs/masterpage/DS/icons/" + sIconFileName;
var sImgTag = "<img id='" + ctx.CurrentItem.ID + "' ";
sImgTag += "src='" + sIconSrc + "' ";
sImgTag += "/>";
return sImgTag;
}
1
source | link