Jquery paging plug-in jquery. pagination. js implements no-refreshing paging and jquery does not-refreshing paging plug-in.

Source: Internet
Author: User

Jquery paging plug-in jquery. pagination. js implements no-refreshing paging and jquery does not-refreshing paging plug-in.

This article provides examples of the jquery paging plug-in code for implementing the non-refreshing paging function for your reference. The details are as follows:

1. Use the plug-in jquery. pagination. js. If this js file is not available, I can send it to you.

First, reference jquery. pagination. js (split page js), with pagination.css (paging style css ).

Click get to view the two files

2. The page js Code is

<Script type = "text/javascript"> var pageIndex = 0; // the initial value of the page index var pageSize = 15; // The number of entries displayed on each page is initialized and the number of entries displayed is modified, modify $ (function () {InitTable (0); // Load event to initialize table data. The page index is 0 (the first page) // page, pageCount is the total number of entries, which is a required parameter. Other parameters are optional $ ("# Pagination "). pagination (<% = pcount %>, {callback: PageCallback, // PageCallback () is the paging function. Prev_text: "«previous page", next_text: "Next page»", items_per_page: pageSize, num_edge_entries: 2, // number of first and last pages on both sides num_display_entries: 6, // current_page: pageIndex, // current page index}); // call function PageCallback (index, jq) {InitTable (index );} // request data function InitTable (pageIndex) {$. ajax ({type: "POST", dataType: "text", url: 'http: // www.cnblogs.com/tool/Reserver/ManageBuyBatchManage.ashx', // submit to the general processing program for data: "pageIndex =" + (pageIndex) + "& pageSize =" + pageSize, // submit two parameters: pageIndex, pageSize, success, function (data) {$ ("# Result tr: gt (0 )"). remove (); // remove the rows in the table whose Id is Result, starting from the second row (changes depending on the page layout) $ ("# Result "). append (data); // append the returned data to the table}) ;}}); </script>

3. The code in the page <body> is

<Table width = "100%" border = "0" cellspacing = "0" cellpadding = "0"> <tr> <td width = "60" align = "right"> product name: </td> <td width = "200" align = "left"> <input type = "text" id = "txtKeywords" class = "keyword"/> </td> <td width = "200" align = "left"> <input id = "search" type = "button" value = "" class = "submit"/> </ td> </tr> </table> <table id = "Result" cellspacing = "0" cellpadding = "0"> <tr> <th> product no. </th> <th> product name </th> </tr> </table> <div id = "Pagination" class = "right flickr"> </ div>

4. The page background code is

Protected int pcount = 0; // total number of entries protected void Page_Load (object sender, EventArgs e) {if (! IsPostBack) {BLL. tbGoods bll = new BLL. tbGoods (); pcount = bll. getRecordCount ("Status = '" + (int) Enum. recordStatus. normal + "'"); // obtain the total number of pages, that is, the total number of actual data items. If you do not understand it, select count (*) from Table, the number here. }}

5. The General handler fffff. ashx code is

Using System; using System. collections. generic; using System. linq; using System. web; using System. text; using System. data; namespace EShop. web. admin. tool. reserver {/// <summary> /// summary of ListBuyBatchManage /// </summary> public class ListBuyBatchManage: IHttpHandler {public void ProcessRequest (HttpContext context) {context. response. contentType = "text/plain"; String str = string. empty; if (context. re Quest ["pageIndex"]! = Null & context. request ["pageIndex"]. toString (). length> 0) {int pageIndex; // The specific page number int. tryParse (context. request ["pageIndex"], out pageIndex); if (context. request ["pageSize"]! = Null & context. request ["pageSize"]. toString (). length> 0) {// number of entries displayed on the page int size = Convert. toInt32 (context. request ["pageSize"]); string data = BindSource (size, pageIndex); context. response. write (data); context. response. end () ;}}# region refreshing public string BindSource (int pagesize, int page) {BLL. tbGoods bll = new BLL. tbGoods (); DataSet ds = bll. getListByPage ("Status = '" + (int) Enum. recordStatus. normal + "'", "", Pagesize * page + 1, pagesize * (page + 1); // retrieve the ds of the data source. StringBuilder sb = new StringBuilder (); if (ds! = Null) {foreach (DataRow row in ds. tables [0]. rows) {sb. append ("<tr> <td>"); sb. append (row ["GoodsUid"]); sb. append ("</td> <td>"); sb. append (row ["GoodsName"]); sb. append ("</td> </tr>") ;}} return sb. toString () ;}# endregion public bool IsReusable {get {return false ;}}}}

6.

The above is all the content of this article, hoping to help you learn.

Articles you may be interested in:
  • JS + Ajax + Jquery implement the implementation of refreshing pages and grouping
  • Jquery pagination plug-in implements the code for refreshing pagination
  • Using php jquery to classify news tags and refreshing pagination
  • Transformation Method of Jquery paging plug-in (server-side paging)
  • How to Implement jquery. pagination. js without refreshing pagination
  • Sharing carefully selected 12 excellent jQuery Ajax paging plug-ins and tutorials
  • Asp.net jquery (jquery. pagination. js)
  • JQuery Pagination Ajax paging plug-in (no refreshing or delay during paging switching)
  • Jquery paging plug-in AmSetPager (self-write)
  • Example code of JQuery + Ajax without refreshing pagination

Related Article

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.