Hi Guys, I have a site collection /sites/devĀ
And i uploaded in here a js file wich is attached and i want to put this on web part of a list custom.
and i want js to be executed on this list only so i put there in miscellaneous
the url for which is ~sites/dev/masterpage/js like that.
but its not running . Any helpĀ
(function () {
var itemCtx = {};
itemCtx.Templates = {};
itemCtx.Templates.Header = TestList;
itemCtx.Templates.Item = ItemOverrideFun;
itemCtx.Templates.Footer = “</ul>”;
itemCtx.BaseViewID = 1;
itemCtx.ListTemplateType = 100; //may be thsi is issue.
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(itemCtx);
})();
function ItemOverrideFun(ctx) {<
if(ctx.CurrentItem.Title ==’English’ {return “<li style=’background-color:Orange></li>”
if (ctx.CurrentItem.Marks == ‘< 50’)
{
return “<span><li style=’background-color: #52D017;width: 300px;height: 24px;’>” + ctx.CurrentItem.Title + ” ā ” + ctx.CurrentItem.Marks + “</li></span>”;
}
if (ctx.CurrentItem.Marks == ‘> 50’)
{
return “<span><li style=’background-color: #4AA02C;width: 300px;height: 24px;’>” + ctx.CurrentItem.Title + ” ā ” + ctx.CurrentItem.Marks + “</li></span>”;
}
if (ctx.CurrentItem.Marks == ‘< 10’)
{
return “<span><li style=’background-color: #FF0000;width: 300px;height: 24px;’>” + ctx.CurrentItem.Title + ” ā ” + ctx.CurrentItem.Marks + “</li></span>”;
}
if (ctx.CurrentItem.Marks == ‘> 10K’)
{
return “<span><li style=’background-color: #D16587;width: 300px;height: 24px;’>” + ctx.CurrentItem.Title + ” ā ” + ctx.CurrentItem.Marks + “</li></span>”;
}
}