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分页翻转滑块是一款使用网格样式与滑块效果分页的特效.
随机推荐
- inline-block间隙原因和解决方法(web前端问题)
申明:IE7无法测试,所以下面说的IE6指IE6和IE7 1,遇到的问题 Normal 0 7.8 磅 0 2 false false false EN-US ZH-CN X-NONE /* Styl ...
- Java-struts2 通过MODEL接收表单数据的方法
接收数据的时候经常会出问题: 1.记住action = “”到的路径,最好用全路径 <a href="../Struts/user/hello?user.name=xxzzzzzzzz ...
- PHP 正则通配符
$a = preg_match('/ph+p/','aaaphpbbbp'); +的前导就是h $a = preg_match('/ph+p/','aaaphhhhhhhhhhpbbbp'); //第 ...
- Visual Studio 2013 RTM 中文语言包官方下载地址发布
如果你下载的是英文版,你想安装一个中文的visual studio 2013,那么你大可不必重新下载安装visual studio 2013,因为微软提供了Visual Studio 2013 RTM ...
- android系统体系结构
android系统底层是建立在Linux系统之上的,如下图 从上图可以看出android系统有五部分组成 1.APPLICATIONS(应用程序层) 包含一些核心应用程序,电子邮件,日历,地图,浏览器 ...
- 停止Java线程,小心interrupt()方法
来源:http://blog.csdn.net/wxwzy738/article/details/8516253 程序是很简易的.然而,在编程人员面前,多线程呈现出了一组新的难题,如果没有被恰当的解决 ...
- Apache 多站点(虚拟主机)
普遍 apache多站点(灰色(连接一起的红色)字体 为命令) 编辑文件:httpd.conf 找到以下内容: # Virtual hosts # Include /private/etc/apach ...
- ubuntu 安装apache2,mysql,php5,phpmyadmin等软件
1.安装apache2 sudo apt-get install apache2 输入Y回车 apache2 安装完成 检测:在浏览器输入localhost 出现It works则成功. 2. ...
- linux安装python使用的MySQLdb
安装mysqldb模块需已安装mysql 使用pip安装MySQLdb pip install mysql-python mac os安装mysqldb sudo pip install mysql- ...
- 2016022613 - redis连接命令集合
redis连接命令 1.ping 用途:检查服务器是否正在运行 返回数据pong,表示服务器在运行. 2.quit 用途:关掉当前服务器连接 3.auth password 用途:服务器验证密码 没有 ...