I've found various methods to return the default values for the field template override, including lookup, but I have been unable to find or successfully implement a method to do the same for fields in a Item Template that are not simply text (i.e. Lookup, People and Groups, etc...). In my code below, I would like to have the lookup field (ctx.CurrentItem.solSiteActSitesStatus) render as it normally would, as a modal dialog link to the item, in OTB list views. With this code, I get [object Object].
SP.SOD.executeFunc("clienttemplates.js", "SPClientTemplates", function () {
function init() {
SPClientTemplates.TemplateManager.RegisterTemplateOverrides({
Templates: {
Item: function (ctx) {
var varItemTitle = ctx.CurrentItem.Title;
var varSiteLocStatus = ctx.CurrentItem.solSiteActSitesStatus;
varSiteLocHtml = "<tr class=\"ms-itmHoverEnabled ms-itmhover\" role=\"row\">" +
"<td height=\"100%\" class=\"ms-cellstyle ms-vb-title\" colspan=\"99\">" +
"<div title=\"Item Details\" style=\"cursor:pointer;\" class=\"link-set\"><div>" + varItemTitle +
"</div><div>Status: " + varSiteLocStatus +
"</div></div></td></tr>";
return varSiteLocHtml;
}
}
});
}
RegisterModuleInit(SPClientTemplates.Utility.ReplaceUrlTokens("~site/SiteAssets/js/kdeReqSiteLocItemCSR-TESTING2.js"), init);
init();
});