function myCSRtemplate( ctx )
All CSR examples out there only pass the ctx object to the template function:
FieldContext.Templates = {};
FieldContext.Templates.Fields = {
"myColumn": {
"View": myCSRtemplate
};
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(FieldContext);
function myCSRtemplate(ctx){
var name = ctx.CurrentFieldSchema.Name;
var value = ctx.CurrentItem[name];
var ID = ctx.CurrentItem.ID;
}
Is this a remnant of some early blogs because the Form overrides only receive one parameter?
function myCSRtemplate(ctx, CurrentFieldSchema, CurrentItem, ListSchema)
Is there another reason why we are all not using the default 2nd, 3rd and 4th parameter SharePoint passes into the function (for View templates)?
function myCSRtemplate(ctx, CurrentFieldSchema, CurrentItem, ListSchema){
var name = CurrentFieldSchema.Name;
var value = CurrentItem[name];
var ID = CurrentItem.ID;
}
TIA
Danny
ICSR
ctx
object? Making it a "do what you like" thing? :)