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

Override function in Client Side Rendering(JS Link) is not working

$
0
0

Hi,
This is the first time I am trying JS Link in SharePoint. I do not have access to master pages. So, I have loaded below js file in Site Assets and referred in JS Link as: ~site/SiteAssets/CSR.js

RegisterModuleInit('/SiteAssets/CSR.js', updateTitle);
updateTitle();


function updateTitle() {
alert(1);
    var priorityFiledContext  = {};
    priorityFiledContext.Templates = {};
    priorityFiledContext.Templates.Fields = {
        'Title': {'View': priorityFiledTemplate}
    };

    SPClientTemplates.TemplateManager.RegisterTemplateOverrides(priorityFiledContext);

alert(2);
}

function priorityFiledTemplate(ctx) {
alert(3);
var tem= ctx.CurrentItem[ctx.CurrentFieldSchema.Name];
return "<span style='color:green;font-weight:bolder'>"+tem+"</span>";
}

Alerts 1 and 2 are fired but alert 3 is not working. That is, priorityFiledTemplate is never called. I have tried forced refresh(ctrl+F5) but still there is no change. Can anyone please help me


Regards, Sathiya



Viewing all articles
Browse latest Browse all 7589

Trending Articles



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