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

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;




  • Not sure what you are aming at, but are not those properties also available in the ctx object? Making it a "do what you like" thing? :) – Robert Lindgren Jul 19 '15 at 13:56
  • I guess also must of the blogs around are quite easy proof-of-concept implementations not really using those variables – Robert Lindgren Jul 19 '15 at 14:14
  • I wondered if there was an issue with those extra existing variables; even the MSDN examples do not use them. – Danny '365CSI' Engelman Jul 20 '15 at 20:38

Answering my own question to get it out of the un-answered list

Yes, the View Template functions get 4 parameters

Perfectly valid to use them

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.