Realization of paging function based on jquery

Source: Internet
Author: User

1th Step: Analyzing the problem my side of the process is to automatically generate page numbers based on the number of data bars passed in, and the number of page numbers that need to be displayed. For example, if the parameter passed in is {pagesize:10,totalrow:200} Then there is a total of 20 pages.

First-generation page numbering style:

2nd step: Click on the action 2 or Next page button style:

3rd step: Generate a new page the number of pages visible here is 10. The code processing mechanism is, with 6 as median is the middle value, refresh the page number click 6 Style:

The 4th step: Click the page number after 6, or the next page button, will refresh the page, style:

HTML structure

<id= "pagination">         </div>

JS call Getdatafun for the action after the click, can be an AJAX request

$ ("#pagination"). Paging ({pagesize:10,totalrow:200,getdatafun:getdata})

The downside is that you need to rewrite the DOM every time you refresh the page. Should be the time to refresh the page only to change the number of pages, there is time to optimize--, the most recently written things are often used by some small features, novice. If there is a mistake, please correct the online preview. Is the need to own site or blog Park has this feature, I did not find

If necessary, complete code demo download Paging.zip

Realization of paging function based on jquery

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.