Category Archives: SharePoint

SharePoint JSLink – disable the filter and sorting pane on list view headers

I had the requirement to disable the functionality to sort and filter on column headers in the list view. I could not find a lot about it online so here is my solution using CSR/JSLink and Jquery


(function () {
var Context = {};
Context.OnPostRender = disableHeaderFilter;
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(Context);
})();

function disableHeaderFilter(renderCtx)
{
var linkTitleField = renderCtx.ListSchema.Field[5];
$("div[name="+ linkTitleField.Name + "]").parent().replaceWith('<th class="ms-vh2">' + linkTitleField.DisplayName + '</th>');
}

The 5 in the code is the column number order in the header

Tags :