The CreatorCon Call for Content is officially open! Get started here.

How do you show filters by default on search page

Shannon Burns
Kilo Sage

When you view the results on the kb_search page, it hides the filters by default. 

find_real_file.png

 

How do you get it to show the filters by default instead?  I reviewed the code for the knowledge search widget on that page and looked at the options, but I am obviously missing something.

 

Thanks,
Shannon

6 REPLIES 6

art_jones
Kilo Sage

I couldnt find a way to do this thru configuration either. I cloned the knowledge search widget and then added a new line to to link function directly below the showAndHideFilters function that calls the function when the page loads.

find_real_file.png

 

Regards, Art

ecagle
Tera Contributor

Thanks for this info!  After adding this line, the filters are displayed by default on the kb_search page, however, if I do a search - the filters are hidden when the search results are displayed.  Do you know of a way to get them to keep showing (until the user clicks to hide)?

If you remove this line from the modified "Knowledge Search" Widget's "Link Function" section:

 

c.hideFilters();

 

it should work

SusanWinKY
Kilo Sage

I was able to do this* with these changes...

  1. On the Knowledge Search page, I added this to the page-specific CSS.  This forces the filter options to always display.

    .hide-filters { // replicates behavior of .show-filters
      display :block;
    }
    .expand-width { // replicates behavior of .original-width
      width :75%;
    }

  2. On the Knowledge Search widget instance, I added this to the CSS.  This hides the toggle button for the filtering options.

    .filter-class{
      display: none;
    }
This not only forces the filters to display when the page initially loads, but also removes the option for the user to toggle on/off the filtering options. So the filters are always displayed. 
 
If you don't mind disabling the ability for users to toggle on/off the filtering options, I prefer this over customizing the widgets.

Susan Williams, Lexmark