JS Code:
var pageIndex = 0; Page Index Initial value
var pageSize = 10; Show number of bars per page initialization, modify the number of display, modify here can
var where= ""; Query criteria
var searchwhere= ""; Query criteria
function Pageset (data) {
Paging, PageCount is the total number of entries, this is a required parameter, other parameters are optional
$ ("#Pagination"). Pagination (data, {
Callback:pagecallback,
Prev_text: ' Previous page ',//Previous button in text
Next_text: ' next page ',//Next button in text
Items_per_page:pagesize,//display number of bars
Num_display_entries:6,//number of page entries in the main part of a continuous page
Current_page:pageindex,//Current page index
Num_edge_entries:2//Page entry number of both sides
});
}
$ (function () {
$.get (".. /ajaxhandler/getpagecount.ashx ", {pwhere:searchwhere,strwhere:where,tb:3},function (data) {
Pageset (data);
});
});
$ ("#strWhere"). Bind ("Change", function () {
var type1=$ ("#strWhere option:selected"). Val ();
alert (type1);
var where1= "";
Switch (type1) {
Case "All":
Where= "";
Break
Case "Repair Registration":
Where= "Repair Registration";
Break
Case "Arrival Confirmation":
Where= "Repair Registration, arrival confirmation";
Break
Case "Repair Start":
Where= "Repair registration, arrival confirmation, maintenance start";
Break
Case "Repair Complete":
Where= "Repair registration, arrival confirmation, maintenance start, maintenance completed";
Break
Case "Device Delivery":
Where= "Repair registration, arrival confirmation, maintenance start, maintenance completed, equipment delivery";
Break
}
$ ("#emptable tbody tr"). Remove (); Remove rows from a table with ID result, starting with the second line (this changes depending on the page layout)
$.get (".. /ajaxhandler/getpagecount.ashx ", {pwhere:searchwhere,strwhere:where,tb:3,t:" 6,8,10,11 "},function (data) {
Pageset (data);
});
Inittable (PageIndex);
});
$ ("#search"). Bind ("click", Function () {
searchwhere=$ ("#searchvalue"). Val ();
$ ("#emptable tbody tr"). Remove ();
$.get (".. /ajaxhandler/getpagecount.ashx ", {pwhere:searchwhere,strwhere:where,tb:3,t:" 6,8,10,11 "},function (data) {
Pageset (data);
});
Inittable (PageIndex);
});
Page Call
function Pagecallback (index, JQ) {
$ ("#emptable tbody tr"). Remove (); Remove rows from a table with ID result, starting with the second line (this changes depending on the page layout)
Inittable (index);
}
Request data
function Inittable (pageIndex) {
var twhere=where;
var pwhere=searchwhere;
$.ajax ({
Type: "POST",
DataType: "JSON",
URL: '.. /ajaxhandler/repairselect.ashx ',//submit to general handler request data
Data: "pageindex=" + (PageIndex + 1) + "&&strwhere=" +twhere+ "&&pwhere=" +pwhere,//Submit a parameter: PageIndex ( Page index)
Success:function (data) {
var html= "";
var loginuser=$ ("#loginUser"). Val ();
$.each (Data,function (k,v) {
var arrays=v.status.split (', ');
if (loginuser== "sysadmin") {
html+= "<tr class= ' Gradex Odd ' ><td><input class= ' checkboxes ' value= ' +v.id+ ' type= ' checkbox '/></td><td><a href= ' #responsive2 ' data-toggle= ' modal ' onclick= ' Lookdetail ("+v.reportnum+") ' alt= ' View Details ' > +v.reportnum+ ' </a> </TD><TD ><a href= ' #responsive3 ' data-toggle= ' modal ' onclick= ' Looksnu (this) ' alt= ' view detailed ' > ' +v. snumber+ "</a></td><td name=" +v.status+ ">" +arrays[arrays.length-1]+ "</TD><TD >" +v. companyname+ "</TD><TD >" +v.reporter+ "</td><td><a href= ' #responsive2 ' data-toggle= ' Modal ' onclick= ' Lookdetail ("+v.deliverynum+") ' alt= ' View Details ' > +v.deliverynum+ ' </a></td><td> <a href= ' javascript:; ' onclick= ' lookstatus (this) ' class= ' btn mini blue ' ><i class= ' icon-reload ' ></i&Gt View </a></td><td ><div style= ' width:100px; White-space:nowrap;overflow:hidden;text-overflow:ellipsis, ' title= ' +v.reason+ ' > ' +v.reason+ ' </div></ TD><TD style= ' width:190px;margin:0; padding:8px 0; ' ><a href= ' #responsive0 ' id= ' checkin ' scr= ' +v.id+ ' data-toggle= ' modal ' class= ' btn mini blue ' onclick= ' check (this) ;‘ ><i class= ' icon-edit ' ></i> register </a> | <a href= ' #responsive1 ' id= ' checkin ' Scr= "+v.id+" data-toggle= ' modal ' class= ' btn mini blue ' onclick= ' Updateq (this); ' ><i class= ' icon-edit ' ></i> edit </a> | <a href= ' javascript:; ' onclick= ' Del ( "+v.id+") ' class= ' btn mini black ' ><i class= ' icon-trash ' ></i> delete </a></td></tr> ';
}else{
html+= "<tr class= ' Gradex Odd ' ><td><input class= ' checkboxes ' value= ' +v.id+ ' type= ' checkbox '/></td><td><a href= ' #responsive2 ' data-toggle= ' modal ' onclick= ' Lookdetail ("+v.reportnum+") ' alt= ' View Details ' > +v.reportnum+ ' </a> </TD><TD ><a href= ' #responsive3 ' data-toggle= ' modal ' onclick= ' Looksnu (this) ' alt= ' view detailed ' > ' +v. snumber+ "</a></td><td name=" +v.status+ ">" +arrays[arrays.length-1]+ "</TD><TD >" +v. companyname+ "</TD><TD >" +v.reporter+ "</td><td><a href= ' #responsive2 ' data-toggle= ' Modal ' onclick= ' Lookdetail ("+v.deliverynum+") ' alt= ' View Details ' > +v.deliverynum+ ' </a></td><td> <a href= ' javascript:; ' onclick= ' lookstatus (this) ' class= ' btn mini blue ' ><i class= ' icon-reload ' ></i&Gt View </a></td><td ><div style= ' width:100px; White-space:nowrap;overflow:hidden;text-overflow:ellipsis, ' title= ' +v.reason+ ' > ' +v.reason+ ' </div></ TD><TD style= ' width:130px;margin:0; padding:8px 0; ' ><a href= ' #responsive0 ' id= ' checkin ' scr= ' +v.id+ ' data-toggle= ' modal ' class= ' btn mini blue ' onclick= ' check (this) ;‘ ><i class= ' icon-edit ' ></i> register </a> | <a href= ' #responsive1 ' id= ' checkin ' Scr= "+v.id+" data-toggle= ' modal ' class= ' btn mini blue ' onclick= ' Updateq (this); ' ><i class= ' icon-edit ' ></i> edit </a></td></tr> ";
}
});
$ ("#emptable tbody"). Append (HTML); Append the returned data to the table
}
});
}
jquery pagination.js Pagination