Skip to content
This repository has been archived by the owner on Jan 2, 2021. It is now read-only.

Problem behind the wheel #51

Open
jescobedoD opened this issue Apr 11, 2017 · 1 comment
Open

Problem behind the wheel #51

jescobedoD opened this issue Apr 11, 2017 · 1 comment

Comments

@jescobedoD
Copy link

jescobedoD commented Apr 11, 2017

Implemte the paginated adding in the method paged an ajax call to the server to bring new data. The pager works fine when I go forward but when it goes back this one restarts and stays with the default values.

Image when I arm the pager
image

Image when the pager restarts
image

$('.pagination').jqPagination({
link_string: '/?page={page_number}',
max_page: _maxPage,
page_string: 'Página {current_page} de {max_page}',
paged: function(page) {
$("#currpage").val(parseInt(page));
/// ajax function
$.ajax({
type: "GET",
url: "/filtroajax",
data: $('#_form').serialize(),
success: function(json) {
var obj = jQuery.parseJSON(json);
var count = jQuery.parseJSON(obj.count);
var CantidadRegistros = parseInt(count[0].registros);
var ixp = parseInt($("#ixp").val());
$("#tbl_result > tbody ").empty();
$.each(jQuery.parseJSON(obj.source), function(i, item) {
var row = '' +
'' + item.id_equipment + ' ' +
'';
$("#tbl_result > tbody ").append(row);
});
},
error: function() {
window.alert('ERORR Peticion');
}
});
///****** Fin ajax Paginacion *****/
}
});

regards

@jescobedoD
Copy link
Author

I have discovered that this problem occurs when the pager is inside a function, on the contrary if I leave it in the ready document it works without problems

This works
$(document).ready(function() { $('.pagination').jqPagination({ link_string : '/?page={page_number}', max_page :2, paged : function(page) { console.log(' Requested page ' + page + ' '); } }); });

This does not work
$(document).ready(function() { paginador(); }); function paginador(){ $('.pagination').jqPagination({ link_string : '/?page={page_number}', max_page :2, paged : function(page) { console.log(' Requested page ' + page + ' '); } }); }

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant