I need to make bythe action of clicking on the title of a list item, to open the edit form, and not the view form. To do this I chose theto use CSR,.
I have the following 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 does not exist. My
Here is 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 canCan I do what I want in a different way?