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分页翻转滑块是一款使用网格样式与滑块效果分页的特效.
随机推荐
- Quarzt.NET的Cron表达式理解
网上关于Quarzt.NET的Cron表达式介绍有很多,但都是基本的语法,稍微深入一些的就没有了. 基本语法介绍请参看: http://www.cnblogs.com/lzrabbit/archive ...
- Linux中一些目录名称的含义
挖Linux中的古老缩略语[2005-06-22 15:23][Nigel McFarlane][TechTarget] Unix已经有35年历史了.许多人认为它开始于中世纪,这个中世纪是相对于计算机 ...
- 在CentOS6.0上安装Oracle 11gR2 (11.2.0.1)以及基本的配置(一)
首先安装CentOS6.0 就不用说了.安装即可.唯一需要注意的就是后面Oracle 11G Installation guide中的Checking the Software Requireme ...
- phpmyadmin备份小问题
不要将imformation——shame或者mysql等备份,要有选择的备份表 关注我的新浪微博
- 读懂IL代码(三)
由于要写毕业论文的缘故,最近比较没有时间写,总是要抽出时间抽出时间.诶,这样的生活比较烦躁. 这一篇主要写委托.类.方法的IL代码,一一来说明. 委托:搞过C#的都应该清楚,委托实际上是一个类.编译器 ...
- Js浏览器对象
Js浏览器对象——window对象 1.window对象: (1)window对象是BOM的核心,window对象指当前的浏览器窗口. (2)所有的JavaScript全局对象.函数以及变量均自动成为 ...
- 169. Majority Element(C++)
169. Majority Element Given an array of size n, find the majority element. The majority element is t ...
- 2D动态光照
对场景内所有点发出射线, 如果射线被某条边阻挡, 则射线停留在阻挡的边上, 如果射线顺利抵达终点, 则对射线偏移-0.001, +0.001角度, 再射出2条射线, 停留在后续的阻挡边上. 把最终的射 ...
- oracle系列索引
今天终于把oracle入门的知识通篇过了一遍. 一篇文章没有写,先做个索引.把知识系统的梳理下. 数据库基本概念-oracle介绍 oracle安装,配置,启动 oracle工具 sqlplus 用户 ...
- Win7下通过easyBCD引导安装Ubuntu14.04
Ubuntu14.04作为目前最新版本的ubuntu系统,相信很多人都想在自己的电脑上安装一下,然而系统的安装方法各式各样,u盘法.grub引导法等等,这里我将介绍在win7系统下用easyBCD软件 ...