1

I need to get the list name (or title) the user is currently viewing to complete a url. I'm good with ctx.Currentitem references but no idea how to get list data like "title". Need something like this replacing list header (obviously not ctx.ListTitle):

 overrideCtx.Templates.Header = "<a  
 href='/site/Lists/" + ctx.ListTitle 
 + "/Calendar.aspx?IsDlg=1'>Access 
 full calendar</a>";

UPDATE: Since the web part already has a link to the list's default view in the title url property, it was easier to reposition that than monkey with the csr file.

1
  • _spPageContextInfo.listTitle would work on the list view, not on a webpart.
    – Mike
    Commented Dec 8, 2017 at 18:13

1 Answer 1

0

In JSLink, the List Title can be got

SPClientTemplates.TemplateManager.RegisterTemplateOverrides({
  Templates: {
       Header:"Hello world from <#= ctx.ListTitle #>!"
  }
});

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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