How to already get some of the checkbox already checked for refinementList widget in Instantsearch js

I want to know is there any way that I can modify my response that I get while using “refinementList” widget.
I want some of the values to be already selected when we get the response
Please help me find out how can I achieve it .
Is “transformItems” helpful in it if so how can I achieve with it ?

Hi @rdabas

You’re on the right track. @myanastasia asked a similar question – here’s the post with some links that may help:

@chuck.meyer I have implemented the functionality using transformItems and setting the “isRefined” property to true for a particular facet .
now the next thing that I want to know is how to only select the checkbox for the first time only .

search.addWidgets([
instantsearch.widgets.refinementList({
container:
“#” + filterAttributesArray[index] + uniqueComponentId,
operator: “or”,
attribute: filterAttributesArray[index],
showMore: true,
showMoreLimit: 200,
transformItems(items) {
items.forEach(function(arrayItem){
if(window.location.pathname.replace(/^/([^/]).$/, ‘$1’)=== “de”){
if(arrayItem.highlighted === “German”){
arrayItem.isRefined= true;
}
}
if(window.location.pathname.replace(/^/([^/]).$/, ‘$1’)=== “fr”){
if(arrayItem.highlighted === “French”){
arrayItem.isRefined= true;
}
}
else{
if(arrayItem.highlighted === “English-US”){
arrayItem.isRefined= true;
}
}
});
return items;
},

            }),
          ]);

I am able to select my desired facets but on the thing is it always remain selected no matter what , I want it to only get selected once and rest is upon the user whether to select it or not .

in simpler words at the code level for e.g. : the “GERMAN” is always selected whenever the user selects other checkbox also


in the screenshot I have only selected one field but in the code we can see there are two li tags with class name of selected ones.
please help me find the solution to what to do,

Thank you for the reply