Message Boards

Adding button to Search Container pagination

Kevin Neibarger, modified 2 Years ago.

Adding button to Search Container pagination

Regular Member Posts: 105 Join Date: 2/2/18 Recent Posts

Hello, I'm using Liferay 7.3 GA6 and I'm wondering about adding a button to the pagination bar. I can add the button via jquery/xpath but it appears Liferay is adding it to the top and bottom bars. I only want the top bar

 


 

In my code, I'm adding like this

var buttonHTML = '<button type="button" class="btn-primary-new-alert-worklist-btn" name="alertWorklistBtn" id="<portlet:namespace/>alertWorklistBtn">Alerts Worklist</button>';

var paginationText=$('.taglib-search-iterator-page-iterator-top').find('div').find('div').find('small').text();

console.log(">> PAGINATION TEXT: "+paginationText);

 

var newPaginationText = paginationText + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + buttonHTML;

 

$('.taglib-search-iterator-page-iterator-top').find('small').html('');

$('.taglib-search-iterator-page-iterator-top').find('small').html(newPaginationText);

As you can see I only append to the taglib-search-iterator-page-iterator-top, so why is it appearing in both the top and bottom pagination bar?? Also, my click event won't work.. I tied it to the both the name "alertWorklistBtn" and the id = "<portlet:namespace/>alertWorklistBtn" with no luck.