jquery-pager分页
首先引用这三个文件
<script src="../../Scripts/jquery-1.4.4.min.js" type="text/javascript"></script>
<script src="../../Scripts/jquery-pager-1.0.js" type="text/javascript"></script>
<link href="../../Scripts/pager.css" rel="stylesheet" type="text/css" />
HTML
<body>
<div>
<div class="title">
<h1>
工作量统计表</h1>
</div>
<table width="50%" border="1" class="t1">
<thead>
<th>
墓型代码
</th>
<th>
墓型名称
</th>
<th>
面积
</th>
<th>
单价
</th>
<th>
累计建墓
</th>
</thead>
<tbody style="text-align: center; font-size: 12px; color: black;">
</tbody>
</table>
<br />
<div id="page-bottom" style="width: 55%; border: 1px;" class="pageinfo">
</div>
</div>
</body>
前端代码:
<script language="javascript" type="text/javascript">
//得到页面数据总数
function getPageCount() {
var result = "";
$.ajax({
type: "POST",
url: "/Manager/WorkStatistic/PageGetCount",
cache: "false",
async: false,
success: function (data) {
result = eval(data);
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert("程序异常!");
}
});
return result;
};
$(document).ready(function () {
//加载页数及页码
var recordCount = getPageCount();
InitPager(recordCount, 1);
});
function Init(PageIndex, PageCount) {
var receive_url = "/Manager/WorkStatistic/WorkStatistics?pageIndex=" + PageIndex + "&PageCount=" + PageCount;
$.ajax({
type: "GET",
url: receive_url,
cache: "false",
success: function (data) {
data = eval(data);
$("tbody").html("");
var html = "";
for (var i = 0; i < data.length; i++) {
var json = data[i];
var mxdm = json.mxdm;
var mxdmmc = json.mxdmmc;
var mj = json.mj;
var dj = json.dj;
var ljjm = json.ljjm;
html += "<tr><td>" + mxdm + "</td><td>" + mxdmmc + "</td><td>" + mj + "</td><td>" + dj + "</td><td>" + ljjm + "</td></tr>";
}
$("tbody").append(html);
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert("程序异常!");
}
});
};
//RecordCount[总记录数] PageIndex[当前页码]
function InitPager(RecordCount, PageIndex) {
$("#page-bottom").setPager({ RecordCount: RecordCount, PageIndex: PageIndex, buttonClick: PageClick });
//分页同时更新数据源
Init(PageIndex, 20);
};
//分页事件
PageClick = function (RecordCount, PageIndex) {
InitPager(RecordCount, PageIndex);
};
</script>
客户端代码:
public ActionResult WorkStatistics()
{
string pageIndex = Request.Params.Get("PageIndex");
string pageCount = Request.Params.Get("PageCount");
int page = Convert.ToInt32(pageIndex) * Convert.ToInt32(pageCount);
string SQL_Init = @"SELECT * FROM ( SELECT rownum RN,t.* FROM ( SELECT a.mxdm,a.mxdmmc,a.mj,AVG((SELECT dj FROM mxdm WHERE a.mxdm= mxdm)) dj,COUNT(*) ljjm"
+ " FROM mwdmxx a WHERE a.azfsdm= '01' GROUP BY a.mxdm ,a.mxdmmc,a.mj ORDER BY a.mxdm) t WHERE rownum <=" + page + ") WHERE RN > " + (page - Convert.ToInt32(pageCount)); DataSet ds = DBhelper.Query(SQL_Init);
//实例化结构体数组
TombType_SaleInfo[] result = new TombType_SaleInfo[ds.Tables[].Rows.Count];
for (int i = ; i < ds.Tables[].Rows.Count; i++)
{
string mxdm = ds.Tables[].Rows[i]["MXDM"].ToString();
string mxdmmc = ds.Tables[].Rows[i]["MXDMMC"].ToString();
double mj = Double.Parse(ds.Tables[].Rows[i]["MJ"].ToString() == "" ? "" : ds.Tables[].Rows[i]["MJ"].ToString());
int dj = Int32.Parse(ds.Tables[].Rows[i]["DJ"].ToString() == "" ? "" : ds.Tables[].Rows[i]["DJ"].ToString());
int ljjm = Int32.Parse(ds.Tables[].Rows[i]["LJJM"].ToString() == "" ? "" : ds.Tables[].Rows[i]["LJJM"].ToString()); TombType_SaleInfo temp = new TombType_SaleInfo(mxdm, mxdmmc, mj, dj, ljjm);
result[i] = temp;
}
return Json(result, JsonRequestBehavior.AllowGet);
}
//得到数据总条数
public void PageGetCount()
{
string SQL_Init = @"SELECT count(*) FROM (SELECT count(a.mxdm) FROM mwdmxx a WHERE a.azfsdm= '01' GROUP BY a.mxdm ,a.mxdmmc,a.mj )";
string count = DBhelper.GetScalar(SQL_Init);
Response.Write(count);
Response.End();
}
jquery-pager分页的更多相关文章
- 用jquery.pager.js实现分页
1.html <link href="/stylesheets/Pager.css" rel="stylesheet" type="text/c ...
- 转:精心挑选的12款优秀 jQuery Ajax 分页插件和教程
在这篇文章中,我为大家收集了12个基于 jQuery 框架的 Ajax 分页插件,这些插件都提供了详细的使用教程和演示.Ajax 技术的出现使得 Web 项目的用户体验有了极大的提高,如今借助优秀的 ...
- 分享一个手机端好用的jquery ajax分页类
分享一个手机端好用的jquery ajax分页类 jquery-ias.min.js 1,引入jquery-ias.min.js 2,调用ajax分页 <script type="te ...
- jQuery Pagination分页插件
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- Jquery的分页插件
Jquery的分页插件, 用起来还不错. 来自: http://flaviusmatis.github.io/simplePagination.js/ 下载地址: https://github.c ...
- SpringMVC -jquery实现分页
效果图: 关键类的代码: package:utils: SpringUtil.java 通过jdbcTemplate连接oracle数据库 package com.utils; import org. ...
- 12款优秀 jQuery Ajax 分页插件和教程
12款优秀 jQuery Ajax 分页插件和教程 在这篇文章中,我为大家收集了12个基于 jQuery 框架的 Ajax 分页插件,这些插件都提供了详细的使用教程和演示.Ajax 技术的出现使得 W ...
- jquery动态分页
最近一直研究jquery的分页效果,刚刚弄好了一个,拿出来与大家分享.分页效果与时光网的差不多. 网址:http://www.mtime.com/movie/news/all/ 先在aspx页面放置一 ...
- jQuery Pagination分页插件--刷新
源码地址:https://github.com/SeaLee02/FunctionModule/blob/master/UploadFiles/WebDemo/FenYE/FenYeDemo.aspx ...
- jquery 3D分页翻转滑块
jquery 3D分页翻转滑块,jquery分页,jquery插件,jquery,3D翻转,css3分页,360度旋转,网页特效代码3D分页翻转滑块是一款使用网格样式与滑块效果分页的特效.
随机推荐
- navicat 数据库管理工具快捷键
最近在使用navicat 管理数据库中,因为经常要写一些sql的,但是每次都要鼠标点击运行,感觉很不爽,于是找到navicat(以下) 快捷键(最常用的): ctrl + q 打开查询窗口 ctrl ...
- SQL 中case when then else 用法
SQL如下: SELECT DISTINCTsy_haken_type,sy_sagyo_type,sy_kokyaku_cdFROm tbl_syukeiWHERE (sy_sagyo_ymd be ...
- java内存模型及分块
转自:http://www.cnblogs.com/BangQ/p/4045954.html 1.JMM简介 2.堆和栈 3.本机内存 4.防止内存泄漏 1.JMM简介 i.内存模型概述 Ja ...
- 15第十五章UDF用户自定义函数(转载)
15第十五章UDF用户自定义函数 待补上 原文链接 本文由豆约翰博客备份专家远程一键发布
- Ubuntu12.04中安装ns-allinone-2.34
1.首先安装ns2所需的组件.库之类: $sudo apt-get update $sudo apt-get install build-essential $ tcl8.-dev tk8. tk8. ...
- 一个简单的web服务器例子
一个简单的web容器小例子,功能十分简单,只能访问静态资源,对于新手来说还是有一定的意义.主要分三个类 1.server类:主要功能开启socketServer,阻塞server,接收socket访问 ...
- UITableView编写可以添加,删除,移动的物品栏(二)
MyTableViewCell.h文件(自定义ViewCell)的内容: MyTableViewCell.m的内容
- hdoj (1162) 最小生成树
Problem B Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other) Total Sub ...
- LVS 介绍以及配置应用
1.负载均衡集群介绍 1.1.什么是负载均衡集群 负载均衡集群提供了一种廉价.有效.透明的方法,来扩展网络设备和服务器的负载.带宽.增加吞吐量.加强网络数据的处理能力.提高网络的灵活性和可用性 搭建负 ...
- getting “fatal: not a git repository: '.'” when using post-update hook to execute 'git pull' on another repo
Here is the script that ultimately worked. I think the bit I was originally missing that prevented i ...