Gravatar for

Question by kmelkez, Oct 2, 2014 11:13 AM

Facet prototype


I have set a Facet. I try to display count on my items Facet even if 0.

I follow the documentation here :

In step 3, documentation say :

var originalBuildValueCount = Coveo.Ui.Facet.prototype.buildValueCount;

Coveo.Ui.Facet.prototype.buildValueCount = function (facetValue) {
    var count =, facetValue);
    if (count.length == 0) {
        return $('<span/>').addClass(Coveo.Utils.cssPrefix('count')).text('0');
    return count;

But there is no buildValueCount method in that object. Am I wrong ? Is there another way to achieve this ?

Thanks, Matt

1 Reply
Gravatar for

Answer by Jean-François L'Heureux, Oct 2, 2014 1:00 PM

This example seems deprecated. This code seems to have moved to:


This method takes no arguments. So the redefinition and call to the original method shouldn't have the "facetValue" parameter.

Also, the return statement should be changed to:

return Coveo.$('<span/>').addClass('coveo-count').text('0');

Note that methods starting with "_" are considered private and it's not a good practice to override them as they could change in future version of the product.

Gravatar for

Comment by kmelkez, Oct 2, 2014 1:50 PM

Thanks, I've ever try that but removed because as you said it's a "private" prototype method and it shouldn't be override.

Ask a question