Gravatar for npanta@italentcorp.com

Question by narsi, Jun 1, 2017 9:44 AM

Select Value when init

Hi all,

How to select one of the source as default when the coveo is initializing.

1 Reply
Gravatar for flguillemette@coveo.com

Answer by François Lachance-Guillemette, Jun 1, 2017 1:33 PM

Did you try this solution?

Here is what I tried and it worked perfectly:

Coveo.$$(document.getElementById("MY_SEARCH_INTERFACE_ID")).on(Coveo.InitializationEvents.afterInitialization, function() {
    var facet = Coveo.get(document.getElementById("MY_FACET_ID"));
    facet.selectValue("MY_VALUE");
})
Gravatar for npanta@italentcorp.com

Comment by narsi, Jun 1, 2017 2:23 PM

Thanks @François Lachance-Guillemette

I have used this code

var root = Coveo.$(document).find('MY_SEARCH_INTERFACE_ID"'); Coveo.$(root).on(Coveo.InitializationEvents.afterInitialization, function() { var facet = Coveo.get(document.getElementById("MY_FACET_ID")); facet.selectValue("MY_VALUE"); });

and it worked perfectly

Ask a question