Background:
I have a listview 1 and I'm using CSR
for set specific rows with Hyperlinks and hide only a column (called Id with InternalName Id0) in the OnPreRender > Templates
. Here is the code that I have so far:
SPClientTemplates.TemplateManager.RegisterTemplateOverrides({ OnPreRender: function(ctx) { var arrayLength = ctx.ListSchema.Field.length; for (var i=0; i < arrayLength;i++) { switch (ctx.ListSchema.Field[i].DisplayName) { /* This is the column that I'm trying to remove the filtering control. */ case 'Id': ctx.ListSchema.Field[i].DisplayName = ''; ctx.ListSchema.Field[i].AllowGridEditing = 'FALSE'; ctx.ListSchema.Field[i].AutoHyperLink = 'FALSE'; break; default: break; } } },Templates: { Fields: { 'Name': { 'View': function(ctx) { var url = String.format('URL_SAMPLE.aspx?DetailsId={0}&', ctx.CurrentItem.Id0); url = url + "IsDlg=1"; return String.format('<span class=\'cssCSRLinkStyle\' onclick="{0}">{1}</span>', url, ctx.CurrentItem.Id0); } }, /* Here, I just removed the value before rendering. */ 'Id0': { 'View': function(ctx) { return '<span></span>'; } }, } }, });
Problem:
The value of the cells (from the hidden column Id) now are hidden and the displayname of the header column too, but after tried with no success, the header column stills having the filter column
.
how can be disabled/removed filter control in column using CSR
?
1 I created a view for use only a few columns.