Gravatar for debadyuti.sil@gmail.com

Question by Deb, Nov 27, 2014 10:09 AM

How we can disable a facet value so that user can not select that but atleast can view them as disabled?

I would like to some of facet values as read only/disabled,,,how can we do that?any idea will be great help for me.

1 Reply
Gravatar for olamothe@coveo.com

Answer by olamothe, Nov 27, 2014 11:29 AM

There is no option to do that out of the box
A couple approach/possible ideas :

  • Create your own UI widget to display group by request values. More complicated and more work, but then you'd have 100% control of how you are rendering your results. You would need to push your own group by request (using the query builder object), then read those value on the querySuccess event. And then display them in your page.
  • Using css, you could add pointer-events:none on the targeted facet, so that mouse event are off for that facet. Pointer event doc. It's not well supported in IE though Browser support
  • Add an invisible div on top of the targeted facet (using z-index). That div could serve to trap all mouse events.
Gravatar for debadyuti.sil@gmail.com

Comment by Deb, Nov 28, 2014 1:55 PM

I would like to disable multiple facets based on facet values…for example i would like create a javascript function where i can pass facet value and disable it,,,any idea?

Gravatar for olamothe@coveo.com

Comment by olamothe, Nov 28, 2014 5:22 PM

You function could use the :contains selector with the correct facet value. http://api.jquery.com/contains-selector/ $('.CoveoFacet .coveo-value .coveo-caption:contains("' + foobar + '")')

Then you could use css (pointer-events:none) or put a div on top of the selected value, just as I suggested.

Ask a question