I need to make by clicking on the title of a list item, to open the edit form and not the view form. To do this I chose the CSR, I have the code:
(function () {
var statusFieldCtx = {};
statusFieldCtx.Templates = {};
statusFieldCtx.Templates.Fields = {
"Title": {"View": DataFieldViewTemplate},
};
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(statusFieldCtx);
})();
function DataFieldViewTemplate(ctx) {
var data = ctx.CurrentItem.Title;
console.log(data);
}
But I see nothing in the browser console. If I change the code this works, but the title column not exist. My edited code:
(function () {
var statusFieldCtx = {};
statusFieldCtx.Templates = {};
statusFieldCtx.Templates.Fields = {
"dt_x0020_proximo_x0020_contato": {"View": DataFieldViewTemplate},
};
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(statusFieldCtx);
})();
function DataFieldViewTemplate(ctx) {
var data = ctx;
console.log(data);
}
My questions are: Is there any error in my code? I can do what I want in a different way?