I was searching on the internet found a couple of good examples but mostly related to rendering the default render method for forms.
My case is that I have a page with the same list in two webparts with different views, for one I want to apply the CSR for the other I just want to have the default rendering. some people mentioned that you can check the view id and call RenderFieldValueDefault(ctx) but that does not seemed to work, the output is none.
Here is how I tried:
SP.SOD.executeFunc('clienttemplates.js', 'SPClientTemplates', function () {
SPClientTemplates.TemplateManager.RegisterTemplateOverrides({
Templates: {
Fields: {
AnyFieldInternalName: {
View: function (ctx) {
if (ctx.listName !== 'some_unique_id') {
return RenderFieldValueDefault(ctx);
}
return 'haha';
},
},
},
},
OnPreRender: __customPreRender,
OnPostRender: __customPostRender,
});
});
Does anyone know how to achieve this without having to custom handle the "default fields"?
Thanks,
For whoever wondering, I was able to do it with the following code from the clienttemplates.debug.js
So with that I can do something like