jquery.pagination | 基于 jquery.pagination 的定制修改版 | Frontend Framework library
kandi X-RAY | jquery.pagination Summary
kandi X-RAY | jquery.pagination Summary
jquery.pagination
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of jquery.pagination
jquery.pagination Key Features
jquery.pagination Examples and Code Snippets
Community Discussions
Trending Discussions on jquery.pagination
QUESTION
This is regarding the following jQuery Pagination code: https://github.com/gbirke/jquery_pagination/blob/master/src/jquery.pagination.js
Made some customisations to the original code already, with this is a related post regarding the changes made.
Here is the updated code now: https://jsfiddle.net/a6gx5z2o/13/
...ANSWER
Answered 2017-Jul-02 at 18:35It is a bit much to dump the entire plugin code into your question and expect someone to search through it and try to find all of the modifications you have made. I am certainly not prepared to do it.
However, I want to point out a few problems with your approach:
First, you should not be modifying the plugin source directly. In my original answer to you, I made sure to leave the plugin code intact and explicitly overwrote the $.PaginationCalculator.prototype.getInterval
implementation outside of the plugin code. Anyone picking-up your code is not going to know that this plugin code has been modified and will be very confused when the behavior does not comply with the documentation.
Secondly, you should not be hard-coding 7
s all over the place. This plugin code was intentionally designed to support different configurations. By hard-coding in 7
, you have ensured that this code will break for anyone who initializes the plugin with a num_display_entries
that is not 7
.
Thirdly (and similar to the second point), you should not be modifying the default options within the plugin code. The plugin design allows you to pass, for example, your own values for prev_text
and next_text
at initialization.
Although I would not attempt to debug your modifications, I did take a look at original plugin source to see if your new requirement could be met. I believe I was able to meet your requirement by changing just a single line of code. I simply changed the default link text that is set in the $.PaginationRenderers.defaultRenderer.prototype.createLink
method. Again, in order to preserve the plugin source, I would recommend explicitly overwriting the method you want to modify. I have copied the method and have added a comment regarding the line of code I have changed:
QUESTION
This is regarding the following jQuery Pagination code: https://github.com/gbirke/jquery_pagination/blob/master/src/jquery.pagination.js
I can get it to run fine as the current code should, but wondered if anyone has any suggestions to essentially make the pagination show the pages in groups of 7, so they can go from page 1-7 and it only shows those pages in the navigation. Then when they go to page 8, it will show the pages 8-14 and so on.
Rather than just moving up to show 1-7, 2-8, 3-9 etc like shown in this example: https://i.gyazo.com/5afa6e66e7e95f973d83191f45d8296e.mp4
I understand it may be fairly difficult, but I may be wrong!
Bonus would be being able to jump in pages of 7 at a time, but think I can sort that fine once this issue is resolved.
Any suggestions much appreciated.
Thanks a lot!
...ANSWER
Answered 2017-Jul-02 at 08:16The functionality you want is not what implemented in that plugin. One way or another, you will need to modify the plugin code meet your requirements. You could fork the project and create your own modified implementation, or you could overwrite the code in your page after the plugin has been loaded. I will give you an example of the second alternative.
Taking a peek at the plugin source code, we find this helpful comment:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install jquery.pagination
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page