Gravatar for

Question by Jim Lynch, Jul 20, 2016 6:17 PM

Allow facet to be toggled for ascending and descending

From a VisualForce page, I want to give the user the ability to toggle a facet in alpha ascending or descending order. I know I can sort in ascending order with the following div:

But how can I allow the order to be toggled between ascending and descending ?

Gravatar for

Comment by Jim Lynch, Jul 20, 2016 6:21 PM

Further I also added the following:


but don't see ascending or descending enabled.

Gravatar for

Comment by Jim Lynch, Jul 22, 2016 12:43 PM

Anyone have any ideas ?

2 Replies
Gravatar for

Answer by gminero, Aug 2, 2016 2:53 PM

Root cause was in the Visualforce Page, there was a script tag configuring the ValueCaption:

var myValueCaption = {  "txt": "Text files" };
 $("#search").coveo("init", {
    Facet: {
        valueCaption: myValueCaption

Our documentation states the following: "Using the valueCaption option disables sort by alpha."

We should probably include this in the facet component documentation as well

Gravatar for

Answer by Simon, Jul 28, 2016 10:28 AM

The data-available-sort attribute is the right thing to use, but do you have the settings enabled?

Gravatar for

Comment by Jim Lynch, Jul 28, 2016 2:40 PM

The default for data-enable-settings is "true" though I did explicitly set it. Here is the div:

    <div class="CoveoFacet" data-title="Wiki Space" data-field="@syscfspacename" data-enable-settings="true" data-available-sorts="alphaAscending, alphaDescending,occurrences,score" data-tab="All, Confluence"></div>
Gravatar for

Comment by Simon, Jul 28, 2016 2:47 PM

You are indeed doing it correctly. You can see a working example here:[English] and it seems to be set the same way you did. Do you have access to support? I would suggest opening a support case. It might be something in the configuration of your Visual Force page conflicting with our controls.

Ask a question