I am trying to implement sitecore search widget and result list is working properly as expected.
I tried filter functionality using facet and by default it is multiple filter functionality.
but as per my requirement i want single select (single facet at time)
I tried but not sure how to archive this functionality. Please help me out.
I tried this but it is not supporting single check It is adding new selected facet id into that array I want to remove previous and add latest
<button onClick={() => { onFacetClick({ facetValueId: selectedArticleTypeValue?.id, facetIndex: 0, facetId: 'article_type', type: 'valueId', checked: false, }); > {jobFacet?.text} </button>
This will not work this way,
As per my understanding it is only support multiple filter in facet. so you have to right custom logic for this what can you do
Something like this
if (selectedValue) {
onFacetClick({
facetValueId: selectedArticleTypeValue?.id,
facetIndex: 0,
facetId: 'article_type',
type: 'valueId',
checked: false,
});
}
if (jobFacet.id) {
onFacetClick({
facetValueId: jobFacet.id,
facetIndex: 0,
facetId: 'article_type',
type: 'valueId',
checked: true,
});
}