Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pagination issue for ajax based tables #48

Closed
musen opened this issue Nov 15, 2014 · 9 comments
Closed

pagination issue for ajax based tables #48

musen opened this issue Nov 15, 2014 · 9 comments
Assignees

Comments

@musen
Copy link

musen commented Nov 15, 2014

The current post variable is not the same for next/prev links and the page number links. Clicking page 2 results in sending current variable as 2 (which is ok) but when clicking next link while on page 1 results in sending 11. This makes server-side processing impossible since we have 2 different values 2 and 11. Can you please fix this.

@rstaib
Copy link
Owner

rstaib commented Nov 16, 2014

Please create a jsfiddle with your code for me! I think you migth have an issue in your code.

@musen
Copy link
Author

musen commented Nov 17, 2014

Appreciate the prompt response! I am using a Codeigniter as a backend and I am not sure how I can jsfiddle it for you. Like I said the problem is the the prev and next links. << (<) 1 2 3 (>) >>. The server-side processing pretty much returns a JSON as specified in the Documentation. Can you please see if you can recreate the issue or perhaps share the server-side code used in the examples.

@musen
Copy link
Author

musen commented Nov 17, 2014

Please have a look at the this pull request. It solved my problem.

@rstaib
Copy link
Owner

rstaib commented Nov 17, 2014

Could you please provide me your exact JSON response. I guess the current property of your JSON response is of type string instead of numeric. To fix your issue just switch to numeric.

Right:

{
    "current": 1,
    ...
}

Wrong:

{
    "current": "1",
    ...
}

I hope this is going to help you.

@rstaib rstaib self-assigned this Nov 17, 2014
@musen
Copy link
Author

musen commented Nov 20, 2014

You are most definitely right but server side response should be parsed to an Integer value before being used by the plugin. Can you please check this pull request and merge in the integer parsing. I think this would make it a full proof solution.

@rstaib
Copy link
Owner

rstaib commented Feb 12, 2015

If you want to use it that way, you could use the responseHandler to parse it to what the component understand or in other words to fulfill the contract between your application and jQuery Bootgrid. But in my opinion it is kind a dirty. Sorry for the latency between your request and my answer - I'm a bit busy at the moment.

@mahmoud-eskandari
Copy link

i try v1.3.1 to use server-side ,But this Issue not Fixed!!! :(
For Example We have <1|2|3|4>
On Ajax
When We click on page 2 Directly bootgrid sending
{
current:2,
...
}
But When page 1 is active And We click on > (Next Button) it send
{
current:11
.
.
.
}
to Server And ,
'1'+'1' = 11
!= 2
maybe This bug happend.
it's very very bad ;~\

@biglidio
Copy link

biglidio commented Dec 19, 2016

At the library jquery.bootgrid.js, you need to change two few lines:
prev: that.current - 1,
next: that.current + 1,

change it to:
prev: parseInt(that.current) - 1,
next: parseInt(that.current) + 1,

@rutpte
Copy link

rutpte commented Feb 25, 2019

biglidio that it work.

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

No branches or pull requests

5 participants