locked
auto collapse search results web parts when refinement panel clicked RRS feed

  • Question

  • In SharePoint 2010 if you have more then one search results part on your page and click a refiner, the ones that the refinement panel is not tied to collapse, is there a way to do that in SharePoint 2013? Is there a way to make my other 3 results web parts collapse or go invisible?

    Friday, June 24, 2016 6:57 PM

Answers

  • Hi ,

    According to your description, my understanding is that you want the Search Results Web Part which tied to the refinement panel can be visible and the others go invisible.

    we can apply custom JavaScript Code to hide Web Part via a Script Editor Web Part.

    Firstly, you can view the refinement panel’s properties to know which Search Results Web Part tied to this panel;

    Then, you can click F12 and use arrow select the web part to know its ID;

    Here is a photo for how to find web part's ID: 

    http://imgur.com/a/XXB2j Here is a detailed article for how to use F12 Developer Tools:https://msdn.microsoft.com/library/gg589512(v=vs.85).aspxFinally, you can hide the other Search Results Web Part via JavaScript.

    <script type="text/javascript">
    window.setTimeout(myfun,3000);
    function myfun(){
    document.getElementById('Container').onclick=function(){
    document.getElementById("MSOZoneCell_WebPartWPQ6").style.display='none';
    document.getElementById("MSOZoneCell_WebPartWPQ5").style.display='none';
    };
    }
    </script>

    Best Regards,

    Andy JY




    • Edited by Andy JY Tuesday, June 28, 2016 3:54 AM
    • Proposed as answer by Andy JY Friday, July 8, 2016 1:52 AM
    • Marked as answer by Patrick_Liang Sunday, July 10, 2016 2:54 PM
    Tuesday, June 28, 2016 3:42 AM

All replies

  • Hi,

    Please check the link below

    https://devspoint.wordpress.com/2013/07/03/auto-collapse-search-refinement-panel-in-sharepoint-2013/


    Please remember to click &#39;Mark as Answer&#39; on the answer if it helps you

    Friday, June 24, 2016 7:13 PM
  • Not the refinement panel, the search results web part itself when the refinement panel is clicked, like I does in sharepoint 2010
    Friday, June 24, 2016 7:14 PM
  • Hi ,

    According to your description, my understanding is that you want the Search Results Web Part which tied to the refinement panel can be visible and the others go invisible.

    we can apply custom JavaScript Code to hide Web Part via a Script Editor Web Part.

    Firstly, you can view the refinement panel’s properties to know which Search Results Web Part tied to this panel;

    Then, you can click F12 and use arrow select the web part to know its ID;

    Here is a photo for how to find web part's ID: 

    http://imgur.com/a/XXB2j Here is a detailed article for how to use F12 Developer Tools:https://msdn.microsoft.com/library/gg589512(v=vs.85).aspxFinally, you can hide the other Search Results Web Part via JavaScript.

    <script type="text/javascript">
    window.setTimeout(myfun,3000);
    function myfun(){
    document.getElementById('Container').onclick=function(){
    document.getElementById("MSOZoneCell_WebPartWPQ6").style.display='none';
    document.getElementById("MSOZoneCell_WebPartWPQ5").style.display='none';
    };
    }
    </script>

    Best Regards,

    Andy JY




    • Edited by Andy JY Tuesday, June 28, 2016 3:54 AM
    • Proposed as answer by Andy JY Friday, July 8, 2016 1:52 AM
    • Marked as answer by Patrick_Liang Sunday, July 10, 2016 2:54 PM
    Tuesday, June 28, 2016 3:42 AM
  • Hi,

    Is there any update for your issue?

    Best Regards,

    Andy Wu


    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.

    Thursday, July 7, 2016 12:32 AM