SUI分页组件和avalon搞定ajax无刷新分页
<div ms-controller="main">
<h2 class="pagination-centered">{{ title }}</h2>
<form method="get" action="" class="sui-form" style="margin-bottom:5px;">
重量:<input class="input-medium" type="text" name="weight" value="@ViewBag.weight" id="weight" />
内容:<input class="input-medium" type="text" name="content" value="@ViewBag.content" id="content" />
解释:<input class="input-medium" type="text" name="intro" value="@ViewBag.intro" id="intro" />
每页:<input class="input-mini" type="text" name="pageSize" value="@ViewBag.pageSize" id="pageSize" />
<input class="sui-btn btn-medium btn-primary" type="submit" name="search" value="查询" id="search" />
</form>
<table class="sui-table table-zebra table-hover table-primary">
<thead>
<tr>
<th width="40">重量</th>
<th width="230">内容</th>
<th>解释</th>
</tr> </thead>
<tbody>
<tr ms-repeat="datalist">
<td style="text-align:center;">{{ el.weight }}</td>
<td>{{ el.content | html }}</td>
<td>{{ el.intro | html }}</td>
</tr> </tbody> </table> <div id="pager"> </div> </div> <script type="text/javascript"> $(function(){ var vm=avalon.define({
$id:"main",
title: "称骨算命",
datalist: [{"weight":"0","content":"内容","intro":"注解"}]
}); var loadData = function (pageIndex,pageSize,weight,content,intro) {
var itemsCount = 0;
$.getJSON("/home/getdata", { "page": pageIndex, "size": pageSize,"weight":weight,"content":content,"intro":intro }, function (data) {
itemsCount = data.total;
vm.datalist = data.rows; $('#pager').pagination({
itemsCount: data.total,
pageSize: pageSize,
currentPage: pageIndex,
displayPage: 6,
displayInfoType: "itemsCount",
styleClass: ['pagination-large'],
showCtrl: true,
onSelect: function (num) {
loadData(num, pageSize, weight, content, intro);
}
}); }); }; loadData(1,$("#pageSize").val(),$("#weight").val(),$("#content").val(),$("#intro").val()); }); </script>
1、控制器
public ActionResult GetData(int page=,int size=,string weight="",string content="",string intro="")
{
int itemsCount = ;
int pageSize = size;
int pageIndex = page; string where = "1=1";
if (!string.IsNullOrEmpty(weight))
{
where += " and weight = '" + weight + "'";
}
if (!string.IsNullOrEmpty(content))
{
where += " and content like '%" + content + "%'";
}
if (!string.IsNullOrEmpty(intro))
{
where += " and intro like '%" + intro + "%'";
} // List<chenggu> list = DBFast.Select<chenggu>(pageIndex, pageSize, where, out itemsCount); using (MAction action = new MAction("chenggu"))
{
return Content(action.Select(pageIndex, pageSize, where, out itemsCount).ToJson()); } //var data=new {Total=itemsCount,DataList=list};
//return Json( data, JsonRequestBehavior.AllowGet);
}
View:
SUI分页组件和avalon搞定ajax无刷新分页的更多相关文章
- ajax 无刷新分页
//ajax 无刷新分页1.前台要做的 滑动时 当前page+1,通过page ajax请求后台接口获取数据将数据进行拼装;2.后台要做的 做分页接口返回json数据前台判断触发请求条件: var p ...
- thinkphp ajax 无刷新分页效果的实现
思路:先做出传统分页效果,然后重新复制一份Page.class.php类,对它进行修改,把js中的函数传到page类中,把上一页.下一页.首页.尾页.链接页中的url地址改成js控制的函数,模板页面中 ...
- 关于Ajax无刷新分页技术的一些研究 c#
关于Ajax无刷新分页技术的一些研究 c# 小弟新手,求大神有更好的解决方案,指教下~ 以前做项目,用过GridView的刷新分页,也用过EasyUI的封装好的分页技术,最近在老项目的基础上加新功能, ...
- thinkphp下实现ajax无刷新分页
1.前言 作为一名php程序员,我们开发网站主要就是为了客户从客户端进行体验,在这里,thinkphp框架自带的分页类是每次翻页都要刷新一下整个页面,这种翻页的用户体验显然是不太理想的,我们希望每次翻 ...
- 学习笔记之AJAX无刷新分页
利用AJAX实现无刷新分页技术原理: 其主要是利用AJAX的异步处理机制,实现数据的异步传递,它隐藏了客户端向服务端请求数据的状态,在客户端表现为无刷新的显示状态. 实现分页的步骤: 1.客服端点击页 ...
- ThinkPhp 3.2 ajax无刷新分页(未完全改完,临时凑合着用)
临时更改后的page类(很多地方没修改...因为笔者PHP没学好..)如下: <?phpnamespace Fenye\libs; /** file: page.class.php 完美分 ...
- Ajax无刷新分页
前台代码: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AjaxPage ...
- ajax分页2:jquery.pagination +JSON 动态无刷新分页
静态页面: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w ...
- jquery+jquery.pagination+php+ajax 无刷新分页
<!DOCTYPE html> <html ><head><meta http-equiv="Content-Type" content= ...
随机推荐
- svn 忽略文件不管用
svn 不能对已添加过版本控制的文件进行忽略.于是乎,你会发先,你怎么忽略都不起作用.于是乎,该怎么办? svn忽略已添加到版本库文件或文件夹步骤: 将要忽略的文件或文件夹剪切到非工作拷贝目录. 在父 ...
- 翻译-DevOps究竟是什么?
原文地址:http://www.drdobbs.com/architecture-and-design/what-exactly-is-devops/240009147 作者:Neil Garnich ...
- webservice 之 WSDL的解析
先看一个wsdl, <?xml version="1.0" encoding="UTF-8" standalone="no"?> ...
- Atitti css3 新特性attilax总结
Atitti css3 新特性attilax总结 图片发光效果2 透明渐变效果2 文字描边2 背景拉伸2 CSS3 选择器(Selector)4 @Font-face 特性7 Word-wrap &a ...
- 【译】采用MVC模式创建一个简单的javascript App
原文标题:Build A Simple Javascript App The MVC Way 作者:joshcrawmer4 翻译人:huansky 初次翻译,翻译的不好,还请见谅 JavaScrip ...
- Java 线程 — ConcurrentLinkedQueue
ConcurrentLinkedQueue 在考虑并发的时候可以先考虑单线程的情况,然后再将并发的情况考虑进来. 比如ConcurrentLinkedQueue: 先考虑单线的offer 再考虑多线程 ...
- 快速入门系列--GIT版本控制工具
由于GIT刚刚开始使用不久,经常会在Merge时出现没有change-id的情况,在结合gerrit使用时,经常出现不能提交的情形,使得自己很困扰.最近有次熬夜加班,在代码完成后,由于多人在很短时间内 ...
- 【博客美化】04.自定义地址栏logo
博客园美化相关文章目录: [博客美化]01.推荐和反对炫酷样式 [博客美化]02.公告栏显示个性化时间 [博客美化]03.分享按钮 [博客美化]04.自定义地址栏logo [博客美化]05.添加Git ...
- java简单词法分析器(源码下载)
java简单词法分析器 : http://files.cnblogs.com/files/hujunzheng/%E7%AE%80%E5%8D%95%E8%AF%8D%E6%B3%95%E5%88%8 ...
- Hadoop官方文档翻译——YARN Architecture(2.7.3)
The fundamental idea of YARN is to split up the functionalities of resource management and job sched ...