Gravatar for shirazi@rdacorp.com

Question by aga, Mar 31, 2015 10:44 AM

How to toggle the facet options using JS UI

Hi,

I'm trying to toggle the facet options using the JS UI. I'm not able to find any documentation on it. Is that even possible?

Thanks

Gravatar for mlaporte@coveo.com

Comment by Martin Laporte, Mar 31, 2015 10:47 AM

Can you be more specific about "facet options"? I can see several matching candidates for this name :)

Gravatar for shirazi@rdacorp.com

Comment by aga, Mar 31, 2015 11:16 AM

If you hit https://answers.coveo.com/coveosearch#sort=relevancy I want to check (or uncheck) the Author, (jflheureux or Vincent) using jsui

1 Reply
Gravatar for olamothe@coveo.com

Answer by olamothe, Mar 31, 2015 2:18 PM

To select or unselect value, you can use the JQuery Extension + the available methods on any Facet component
For example, you could set an id attribute on a given facet and do something like this

< div class='CoveoFacet' data-field='@foobar' id='MyFacet'> < /div>
[...]
$('#MyFacet').coveo().selectValue('test')
$('#MyFacet').coveo().excludeValue('test2')
[ etc.. ]
Ask a question