Conditional Formatting when using filters/search

Hello,

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.

Josh

__________________________________________________________________

<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.
      SPClientTemplates.TemplateManager.RegisterTemplateOverrides(overrideCtx);
  }
)();

function postRenderHandler(ctx) {

....

}

</script>

May 15th, 2015 11:55am

Hi,

Can you please check this

http://jsuhail.blogspot.com/2014/09/client-side-rendering-using-jslink-post_30.html

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

Hi,

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.

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

Hi,

http://infomoss.blogspot.in/2013/10/custom-search-sharepoint-2013.html

chk with url..

May 18th, 2015 1:39am

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

Other recent topics Other recent topics