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

Change pagination behavior and add more customization options to it #256

Merged
merged 3 commits into from
Feb 5, 2016

Conversation

diazproduction
Copy link
Contributor

Hi, I made some changes and adjustments to the way in which the pagination of the tables works:

  • If the table has only one page (or no pages at all), it won't show the navigation controls (first, prev, next, last).
[ 1 ]
  • If the user is on the very first or the very last page of the table, it won't show the first/prev or next/last buttons respectively:
([ 1 ]) [ 2 ] [ 3 ] [ 4 ] [>] [>>]

[<<] [<] [ 7 ] [ 8 ] ([ 9 ])
  • If the first or the last page is within the range of the pagination size, it won't show the first or last button respectively:
[<] [ 1 ] ([ 2 ]) [ 3 ] [ 4 ] [>] [>>]

[<<] [<] [ 7 ] ([ 8 ]) [ 9 ] [>]

(These two last changes were made because in that way you can instantly show to the user where the table begins and ends.)

I also add some props on the options in order to be able of changing the text of the navigation controls, by default they are as they were before (<< < > >>) but now you can specify the name you want to give to it in case you would want change it:

var options = {
   prePage: "Anterior", // Previous page button text
   nextPage: "Siguiente", // Next page button text
   firstPage: "Primero", // First page button text
   lastPage: "Ultimo" // Last page button text
}

[Primero] [Anterior] [ 7 ] ([ 8 ]) [ 9 ] [Siguiente] [ Ultimo ]

I changed too the file custom-pagination-table.js in order to exemplify these customizations' options.

@diazproduction diazproduction changed the title Pagination customization Change pagination behavior and add more customization options to it Feb 5, 2016
@AllenFang AllenFang merged commit a7cc047 into AllenFang:master Feb 5, 2016
@AllenFang
Copy link
Owner

@diazproduction, thanks your contribution, it's a nice patch 👍 Anyway, I've released on v1.5.0

@diazproduction
Copy link
Contributor Author

Thanks! :D

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

Successfully merging this pull request may close these issues.

2 participants