2

Hi I have requirement to give display form link to the title and making description short for document library view.

I have added below code using jslink. The title is rendering as per my requirement, but there is no change in description field.

What i am doing wrong in below code?

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

function updateTitle() {
    var priorityFiledContext  = {};
    priorityFiledContext.Templates = {};    
    priorityFiledContext.Templates.Fields = {
        "Title": {
            "View": priorityFiledTemplate
        },
        "Description": {
            "View": DescriptionFiledTemplate
            }           
    };

    SPClientTemplates.TemplateManager.RegisterTemplateOverrides(priorityFiledContext);
}

function priorityFiledTemplate(ctx) {
    var currentURL = window.location.href;
    var url = String.format('{0}&ID={1}&source={2}', ctx.displayFormUrl, ctx.CurrentItem.ID, currentURL);
    var ret =   "<a href='" + url + "'>" + ctx.CurrentItem.Title + "</a>";  
    return ret; 
}
function DescriptionFiledTemplate(ctx) {        
    return "Test"; 
}
2
  • In place of DescriptionFiledTemplate you place simple Test string to check if that is working or not? – Pradip R. Jul 23 '15 at 12:06
  • Now its working, the issue was internal name was different for description field after using internal name it started working. – P S Jul 23 '15 at 12:24
3

My issue got resolved. Actually Internal name was different for description field. After using internal name my issue got solved.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.