Skip to content

Commit

Permalink
Merge pull request #51 from NewPath-Consulting/50-last-page
Browse files Browse the repository at this point in the history
Fix pagination bug
  • Loading branch information
asirota authored Oct 15, 2024
2 parents ae95c38 + 973588b commit efae135
Showing 1 changed file with 23 additions and 22 deletions.
45 changes: 23 additions & 22 deletions js/pagination.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
(function($) {
let contact_obj = $('.wa-contact');
let contacts = Object.entries(contact_obj);
(function ($) {
let contact_obj = $(".wa-contact");
let contacts = Object.entries(contact_obj);

$(document).ready(function() {
$('.wa-contacts-items').hide();
$('.wa-contacts').pagination({
dataSource: contacts,
pageSize: wawp_memdir_page_size.page_size,
callback: function(data,pagination) {
var html = template(data);
$('.wa-pagination').html(html);
}
});
$(document).ready(function () {
$(".wa-contacts-items").hide();
$(".wa-contacts").pagination({
dataSource: contacts,
pageSize: wawp_memdir_page_size.page_size,
callback: function (data, pagination) {
var html = template(data);
$(".wa-pagination").html(html);
},
});
});

function template(data) {
var html = $("<div></div>");
html.addClass('wa-pagination page');
$.each(data, function(index, item) {
html.append(item[1]);
});
return html;
}

function template(data) {
var html = $("<div></div>");
html.addClass("wa-pagination page");
$.each(data, function (index, item) {
if ($(item[1]).hasClass("wa-contact")) {
html.append(item[1]);
}
});
return html;
}
})(jQuery);

0 comments on commit efae135

Please sign in to comment.