Gravatar for nagasekhar.k@itcinfotech.com

Question by nagasekhar, Aug 19, 2014 7:23 AM

Coveo Search Header

Hi,

I am using CoveoSearch Interface for search in my Sitecore Page.When there are no Search Results i am getting "Your query did not match any documents.".As per our client requirement If i get like this i should hide Header Block.How to this.

Thanks, Naga

1 Reply
Gravatar for vseguin@coveo.com

Answer by Vincent Séguin, Aug 19, 2014 7:42 AM

Hi Naga,

Are you in .NET or in JS UI? If you're using the JS UI, you could easily hook yourself on the 'noResults' event of the search component and hide the header block there.

For example :

Coveo.$('#search').on('noResults', function (e, data) {
    Coveo$.('#myHeaderBlock').hide();
});

To make sure it works, don't forget to show it back again on a querySuccess event.

Gravatar for mlaporte@coveo.com

Comment by Martin Laporte, Aug 19, 2014 8:10 AM

Might be simpler to just listen for querySuccess and using .toggle depending on whether totalCount is 0 or not.

Ask a question