Gravatar for kudumulanarender@gmail.com

Question by kudumulanarender, Oct 28, 2015 10:31 AM

How to change the Next and Previous buttons text in Coveo Pager?

Hi,

I'm trying to remove angular brackets"[" "]" from NEXT and PREVIOUS buttons in pager component. please find the below image for reference.

alt text

I'm head banging with this issue since last one week, any help will be appreciate.

Thanks.

2 Replies
Gravatar for jflheureux@coveo.com

Answer by Jean-François L'Heureux, Oct 29, 2015 1:07 AM

This pager component is from the .Net Front-End. If I remember correctly, the brackets are hardcoded in the component code behind so you unfortunately cannot change it.

Gravatar for kudumulanarender@gmail.com

Comment by kudumulanarender, Oct 29, 2015 2:42 AM

Hi Jean-François,

First let me tell you Thanks for the reply. Yeah I agree with you, I saw this text is hard coded from .Net side.

I tried to change this buttons text using JQuery but it is working only on first time when page loaded. If we change the page using pagination then it is not working. Is there any way to handle this using Jquery/JavaScript?

Gravatar for jflheureux@coveo.com

Comment by Jean-François L'Heureux, Oct 29, 2015 6:54 AM

Unfortunately, the .Net Front-End AJAX framework is completely custom and not very extensible as jQuery is. I don't think you can hook an event handler to be notified of when new results are displayed in the page to be able to run your custom code.

Gravatar for jflheureux@coveo.com

Comment by Jean-François L'Heureux, Jun 15, 2016 4:21 PM

Hi,

I recently stumbled across an answer to another question where @Ronald suggested a solution to get JavaScript code running at each postback. It could be the solution to your question as well.

https://answers.coveo.com/questions/6539/net-ui-and-javascript

I hope this helps,

Jeff

Gravatar for praful.memane@towerswatson.com

Answer by prafulmemane, Jun 15, 2016 4:10 PM

This is what I did for changing the tool tip. I think you can also try and edit the html

var CoveoPager = Coveo.$('.CoveoPager');
    Coveo.$.each(CoveoPager,function(divIndex,CoveoPagerDiv){
        var previousArrows = CoveoPagerDiv.querySelectorAll("li.coveo-previous");
        Coveo.$.each(previousArrows,function(prevArrowIndex,previousArrow){
            previousArrow.querySelector('a').title = '前一页';
            previousArrow.querySelector('a span').title = '前一页';
        });
        var nextArrows = CoveoPagerDiv.querySelectorAll("li.coveo-next");
        Coveo.$.each(nextArrows,function(nextArrowIndex,nextArrow){
            nextArrow.querySelector('a').title = '下一页';
            nextArrow.querySelector('a span').title = '下一页';
        });
    });
});
Gravatar for jflheureux@coveo.com

Comment by Jean-François L'Heureux, Jun 15, 2016 4:17 PM

Hi there,

Your code is intended to work with the Coveo JavaScript Search Framework. The Coveo .Net Front-End doesn't use the same JavaScript framework at all. Thus, this code won't work for this pager component.

Jeff

Ask a question