I assume that you are using a refinement widget: https://community.algolia.com/instantsearch.js/documentation/#refinementlist . In the 'category' attribute of your data.
If so, you can do this:
var preselectedCategories = ['Careers', 'Skills']; var search = instantsearch(applicationID, apiKey, { ...other parameters, searchParameters: { disjunctiveFacetsRefinements: { category: preselectedCategories } } })
You will also need to do this in the refinement instance:
var refinementList = instantsearch.widgets.refinementList({ transformData: { item: function(item) { if (preselectedCategories.indexOf(item.name) !== -1) { item.cssClasses.label += ' pre-selected'; } return item; } } });
Then all pre-selected categories will have a "pre-selected" css class by default.
Then you can use css and this is the class name:
.pre-selected { display: none; }
Tell me
source share