Skip to main content

Posts

Showing posts from May, 2016

Execute custom code after SharePoint List/Library default events (Sort/filter/ Taxonomy Key filter etc.) are fired

Today I came to build a jQuery solution that was supposed to do some text replace operation on SharePoint’s default list views. At first glance the task looked so easy that it can be implemented in a while. After the task was implemented the first issue that I noticed was when you apply filter the SharePoint List/Library the script didn’t do its task. The reason was that when any SharePoint default event like filter, sort or a taxonomy key filter are fired the page is partially posted back. So in order to make your jQuery work with such cases you need to enable your code to get executed when the SharePoint events are fired. Below is the method I which you can place your code and the code will get executed after SharePoint’s default events are fired. SPClientTemplates.TemplateManager.RegisterTemplateOverrides({ OnPostRender: function(ctx) {                 //Your code to be executed after the event returns } }); Above code injects our code to OnPostRen