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.

  • _spPageContextInfo.listTitle would work on the list view, not on a webpart. – Mike Dec 8 '17 at 18:13
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, privacy policy and cookie policy

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