Conditional Formatting when using filters/search


I have some custom JavaScript that I have created to highlight a row in a list if it meets certain criteria.  This works flawless when the page initially loads.  However, when the search or filter options on the list are used the formatting disappears.  The only thing I can think of is that there is another method called after the postRenderHandler executes and it undoes all of the formatting my code does.  Any help would be appreciated.  Thanks in advance.



<script type="text/javascript">
    function () {
      // Initialize the variable that stores the objects.
      var overrideCtx = {};
      overrideCtx.Templates = {};
      //OnPostRender call postRenderHandler function.
      overrideCtx.OnPostRender = postRenderHandler;

      // Register the template overrides.

function postRenderHandler(ctx) {




May 15th, 2015 11:55am


Can you please check this

Free Windows Admin Tool Kit Click here and download it now
May 15th, 2015 12:54pm

Very good post, does your code work when someone filters the list or searches for the item?
May 15th, 2015 2:17pm


According to the code provided, is the code wrapped in a <script> tag and added into the list view page directly?

In SharePoint 2013, the list view(not the whole list view page) will be refreshed once there is filter or search action performed by users.

If your code is added into the list view page, by default, it will run only once, thats the most possible reason that the code runs when page initially loads.

Client Side Rendering(also known as JSLink) is newly introduced since SharePoint 2013, the script will be triggered every time there is a refresh in the list view, it ensures the script works as what it is as the page initially loads.

I suggest you take Lakshmanans suggestion for a try in your environment to see if it will work for you.

Free Windows Admin Tool Kit Click here and download it now
May 18th, 2015 12:57am


chk with url..

May 18th, 2015 1:39am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics