Gravatar for karthik.aspx.cs@gmail.com

Question by cs_nkarthik, Sep 1, 2016 11:55 AM

CoveoHierarchicalFacet collapsed by default.

Dear experts

My CoveoHierarchicalFacet tree is collapsed by default. I try to call the the expand method on facet but it only expands the facet component not the tree in it. Below is my code.

Coveo.$('#search').on('deferredQuerySuccess', function(){

            Coveo.$('.CoveoHierarchicalFacet').coveo('expandFacet');
        });

Anybody has any idea what I am missing to expand the tree?

Thanks Karthik

Gravatar for karthik.aspx.cs@gmail.com

Comment by cs_nkarthik, Sep 1, 2016 1:19 PM

It's very urgent. Could anyone throw two cents ?

Gravatar for cgagnon@coveo.com

Comment by cgagnon, Sep 1, 2016 4:09 PM

Hi Karthik,

What is your version of the Javascript Search Framework you have? Do you use the Salesforce Integration package? From there it will be easier to help you. :)

Thank you Cedric Gagnon

Gravatar for karthik.aspx.cs@gmail.com

Comment by cs_nkarthik, Sep 1, 2016 4:26 PM

Hi Cgagnon

Thank you for your response.

The version we use is "0.9.1287.101" and no we don't use Salesforce integration package.

Thanks Karthik

1 Reply
Gravatar for cgagnon@coveo.com

Answer by cgagnon, Sep 1, 2016 5:13 PM

Hi Karthik, I think you could give a try with the latest maintenance release 0.9.1530.26 at http://productupdate.coveo.com/. It has the 0.9.1287.102 lib version. I tried Coveo.$('.CoveoHierarchicalFacet').coveo('expandFacet'); and Coveo.$('.CoveoHierarchicalFacet').coveo('collapseFacet'); and it worked. :)

Cedric

Gravatar for karthik.aspx.cs@gmail.com

Comment by cs_nkarthik, Sep 2, 2016 12:12 AM

Hi Cedric

Thank you for your response again.

Updating version on my project is a tedious protocol which I don't have time for to complete this task.

The solution you suggested ( Coveo.$('.CoveoHierarchicalFacet').coveo('expandFacet') ) works absolutely fine with older version too but it only expands the facet not the tree.

After a lot of digging, found the below solution.

var facet = Coveo.$('.CoveoHierarchicalFacet').coveo(); var values = facet.values.getAll(); for(var i = 0; i < values.length; i++) { facet.open(values[i]); }

Hope it helps somebody else.

Thank you again for taking the time to respond.

Karthik

Gravatar for ravigupta020287@gmail.com

Comment by Ravi, Dec 26, 2016 4:42 AM

I am using Coveo for sitecore 3.0 i tried the solution above My Code: Coveo.$('#search').on('deferredQuerySuccess', function(e, args){ var facet = Coveo.$('.CoveoHierarchicalFacet').coveo(); var values = facet.values.getSelected(); for(var i = 0; i < values.length; i++) {
facet.open(values[i]); } })

This above code is not working, but when i write the code in browser console and execute it, the facets are expanding as expected, also when switching between the tabs it is working.

What am i doing wrong here?

Ask a question