jeudi 26 février 2015

how to get the url of a list item in jslink?



I am using the jslink code below to display the title of the list in a List View web part as a hyperlink. But the problem is that I don't know how to point to the url of that item? so how can I get the url of that item so that when the user clicks on it it will redirect him to the display page as it normally done by default?



(function () {
var overrideContext = {};
overrideContext.Templates = {};
overrideContext.Templates.Header = "<ul id='local-news2'>"
overrideContext.Templates.Item = CBody;
overrideContext.Templates.Footer = "</ul>"
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(overrideContext);
})();

function CBody(ctx) {

var ret = "<li>" +
"<a href='" + url here + "'>" + ctx.CurrentItem.Title + "</a>" +
"</li>";
return ret; }







0 commentaires:

Enregistrer un commentaire