Jquery.Datatables 服务器处理(Server-side processing)
看了看介绍
http://datatables.club/manual/server-side.html
没有经过处理的分页,先显示出来看看效果,就这样写(存储过程自己写)
cshtml
"serverSide": true,//服务器处理:过滤、分页、排序
"processing": true,//是否显示处理状态(排序的时候,数据很多耗费时间长的话,也会显示这个)
controller.cs
//jquery.datatables
public JsonResult GetUserInfoList()
{
try
{
int pageSize = int.Parse(Request.Params["length"]);
int start = int.Parse(Request.Params["start"]);
int pageIndex = start / pageSize + ; JsonResponse list = UserInfoService.Service.GetDataTablesUserInfoList(pageIndex, pageSize);
return this.Json(list);
}
catch (Exception ex)
{
return this.Json(UnifyResponse.ThrowError(ex));
}
}
bll
public JsonResponse GetDataTablesUserInfoList(int pageIndex, int pageSize)
{
try
{
proc_DataPagination p_page = new proc_DataPagination();
p_page.Table = "UserInfo";
p_page.Fields = "*";
p_page.CurrentPage = pageIndex;
p_page.PageSize = pageSize;
p_page.OrderBy = "ID desc";
p_page.Where = string.Format("1=1");
//p_page.Where = string.Format("openid like '%{0}%'",);
IList<UserInfo> list = DDataBase.WebDB.StoredProcedureToIList<proc_DataPagination, UserInfo>(p_page); JsonResponse mypage = new JsonResponse();
mypage.data = list;
mypage.recordsTotal = p_page.Count;
mypage.recordsFiltered = p_page.Count; return mypage;
}
catch (Exception ex)
{
throw ex;
}
}

<div class="row">
<div class="col-lg-12">
<h1 class="page-header">微信用户管理</h1>
</div>
</div>
<!-- /.col-lg- -->
<!-- /.row -->
<div class="row">
<div class="col-lg-12">
<div class="panel panel-primary">
<div class="row-fluid" id="div-advanced-search">
<form class="form-inline well">
<span>openid:</span>
<input type="text" class="input-medium" placeholder="openid" id="openid-search">
<span>昵称:</span>
<input type="text" class="input-medium" placeholder="昵称" id="nickname-search">
@* <span>工作地点:</span>
<input type="text" class="input-medium" placeholder="工作地点" id="office-search">
<span>编号:</span>
<input type="text" class="input-medium" placeholder="编号" id="extn-search">
<span>在线状态:</span>
<select class="input-small" id="status-search">
<option value="">全部</option>
<option value="">在线</option>
<option value="">离线</option>
</select>
<select class="input-small" id="role-search">
<option value="">全部</option>
<option value="">管理员</option>
<option value="">操作员</option>
</select>*@
<button type="button" class="btn" id="btn-advanced-search"><i class="fa fa-search"></i>查询</button>
<button type="button" class="btn" id="btn-clear-search"><i class=""></i>清空</button>
</form>
</div> <div class="panel-heading">
微信用户
</div>
<!-- /.panel-heading -->

重点来了,搜索就用自定义搜索
//column().search()
//地址:https://datatables.net/reference/api/column().search()
//自定义搜索
//column().search()
//地址:https://datatables.net/reference/api/column().search()
$("#btn-advanced-search").click(function () {
tables.column()
.search($('#openid-search').val())
.column()
.search($('#nickname-search').val())
.draw();
}); //清空
$("#btn-clear-search").click(function () {
$('#openid-search').val('');
$('#nickname-search').val('');
tables.column()
.search($('#openid-search').val())
.column()
.search($('#nickname-search').val())
.draw();
});
Jquery.Datatables 服务器处理(Server-side processing)的更多相关文章
- Jquery DataTables 服务器后端分页 Ajax请求添加自定义参数.
项目使用AdminLTE(基于Bootstrap 二次开发的框架)作为开发框架. 使用DataTables 的时候部分页面需要传参 给后台做筛选过滤. 但是不知道怎么将DataTables的参数 和自 ...
- jquery datatables api (转)
学习可参考:http://www.guoxk.com/node/jquery-datatables http://yuemeiqing2008-163-com.iteye.com/blog/20069 ...
- 最全的jquery datatables api 使用详解
学习可参考:http://www.guoxk.com/node/jquery-datatables http://yuemeiqing2008-163-com.iteye.com/blog/20069 ...
- jquery datatables api
原文地址 学习可参考:http://www.guoxk.com/node/jquery-datatables http://yuemeiqing2008-163-com.iteye.com/blog/ ...
- jQuery DataTables Plugin Meets C#
Over the weekend, I was doing some work on the internal CMS we use over at eagleenvision.net and I w ...
- jQuery DataTables 插件使用笔记
初始化 在页面中 <!DOCTYPE html> <html> <head> <link rel="stylesheet" type=&q ...
- jquery dataTables例子
https://datatables.net/examples/styling/bootstrap.html http://datatables.club/example/#styling http: ...
- JQuery DataTables学习
1.Datatables简单介绍 DataTables是一个jQuery的表格插件.这是一个高度灵活的工具,根据的基础逐步增强,这将添加先进的互动控制.支持不论什么HTML表格. 主要特点: 自己主动 ...
- [jQuery]jQuery DataTables插件自定义Ajax分页实现
前言 昨天在博客园的博问上帮一位园友解决了一个问题,我觉得有必要记录一下,万一有人也遇上了呢. 问题描述 园友是做前端的,产品经理要求他使用jQuery DataTables插件显示一个列表,要实现分 ...
随机推荐
- 3d回顾
手把手教你玩转 CSS3 3D 技术 要玩转css3的3d,就必须了解几个词汇,便是透视(perspective).旋转(rotate)和移动(translate).透视即是以现实的视角来看屏幕上 ...
- 操作PDF文件的关键技术点
一个PDF文档从大到小可以分成如下几个要素:文档.章节.小节.段落.表格.列表. com.lowagie.text.Document表示PDF文档.必须为它创建一个PDF写入器,即com.lowagi ...
- ios10 UNNtificationRequest UNUserNotificationCenter的应用 推送之本地推送
iOS10 已经 "deprected" 我们的UILocalNotification 采用了全新的UNUserNotificationCenter; 1 首先,你需要引进< ...
- Laravel5.1-Eloquent ORM:起步
概述 有很多朋友问,MCV的M是在哪里介绍的,这里就是介绍M的地方了.Laravel有一个强大的数据库ORM Eloquent,它的原理是每张数据表对应一个Model,对Model的操作就对应数据库的 ...
- 跟着百度学PHP[4]OOP面对对象编程-4-对象成员的访问 ->
使用一个减号一个尖括号->来达到访问对象成员. $object->方法 来看案例. <?php class Person{ private $name; "; var $s ...
- 小白死去活来的安装ros_qtc_plugin
在距离写上一篇有关ROS的文章已经过去了很久了.在这段时间内一直在积累,盼望着能够厚积薄发,但还是被无情的社会折磨的死去活来,深深的体会到了一般学校和重点学校找工作的差别,以及用人单位的区别对待.说到 ...
- Java Log4j日志使用
在程序中使用log4j 1.导入包import org.apache.log4j.Logger;import org.apache.log4j.PropertyConfigurator; 2.获取lo ...
- LINQ查询字符串判断是否大写
#region Linq to 字符串char.IsUpper意思是判断是否大写 //string strDemo = "HelloWord!"; ...
- 【leetcode】Merge Intervals
Merge Intervals Given a collection of intervals, merge all overlapping intervals. For example,Given ...
- python模块介绍- collections(5)-OrderedDict 有序字典
1.3.5 OrderedDict 有序字典 OrderedDict是dict的子类,它记住了内容添加的顺序. import collections print 'Regular dictionary ...