Gravatar for

Question by Ben, Jul 31, 2015 1:46 PM

custom-data-sort - Unable to get working with Sitecore MVC

I am unable to get custom sorting working in a facet view using the solution I found in this question:

I have the attribute set like this: data-custom-sort='Products,Magazines,Health Concerns,News Article,Whats Hot,Featured Articles,Other'

This has no effect on the way the facet is sorted.

Coveo.version Object {lib: "0.9.993.17", product: ""}

1 Reply
Gravatar for

Answer by Sébastien Belzile, Jul 31, 2015 4:32 PM


the cause of your problem can be many things. The most obvious are:

  1. The values you enumerate in data-custom-sort must be values of the facet field.
  2. It is case-sensitive.

Look for those things first. If you could show us the values displayed in your facets, it would be great.

Other possible cause: you duplicated the FacetView.cshtml. If you can make it work using the original FacetView.cshtml, than your problem may be that you missed a step while following the guide provided in the answer.

Your version contains everything to make this work.

Gravatar for

Comment by Ben, Aug 3, 2015 8:03 AM

Okay, so the issue is that custom sorting only works in facets with a class of CoveoFacet, but will not work with CoveoHierarchicalFacet. I switched the class back away from Hierarchical and everything works as expected, minus, of course, the ability to persist hierarchy. But at least this gives me a better understanding of the issue.

Ask a question