看了看介绍

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)的更多相关文章

  1. Jquery DataTables 服务器后端分页 Ajax请求添加自定义参数.

    项目使用AdminLTE(基于Bootstrap 二次开发的框架)作为开发框架. 使用DataTables 的时候部分页面需要传参 给后台做筛选过滤. 但是不知道怎么将DataTables的参数 和自 ...

  2. jquery datatables api (转)

    学习可参考:http://www.guoxk.com/node/jquery-datatables http://yuemeiqing2008-163-com.iteye.com/blog/20069 ...

  3. 最全的jquery datatables api 使用详解

    学习可参考:http://www.guoxk.com/node/jquery-datatables http://yuemeiqing2008-163-com.iteye.com/blog/20069 ...

  4. jquery datatables api

    原文地址 学习可参考:http://www.guoxk.com/node/jquery-datatables http://yuemeiqing2008-163-com.iteye.com/blog/ ...

  5. 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 ...

  6. jQuery DataTables 插件使用笔记

    初始化 在页面中 <!DOCTYPE html> <html> <head> <link rel="stylesheet" type=&q ...

  7. jquery dataTables例子

    https://datatables.net/examples/styling/bootstrap.html http://datatables.club/example/#styling http: ...

  8. JQuery DataTables学习

    1.Datatables简单介绍 DataTables是一个jQuery的表格插件.这是一个高度灵活的工具,根据的基础逐步增强,这将添加先进的互动控制.支持不论什么HTML表格. 主要特点: 自己主动 ...

  9. [jQuery]jQuery DataTables插件自定义Ajax分页实现

    前言 昨天在博客园的博问上帮一位园友解决了一个问题,我觉得有必要记录一下,万一有人也遇上了呢. 问题描述 园友是做前端的,产品经理要求他使用jQuery DataTables插件显示一个列表,要实现分 ...

随机推荐

  1. Android学习笔记(一)——新建一个项目

    //此系列博文是<第一行Android代码>的学习笔记,如有错漏,欢迎指正! 1.打开Android Studio时出现以下界面,点击”start a new Android Studio ...

  2. 跟着百度学PHP[3]-PHP中结构嵌套之循环结构与条件结构嵌套

    任务 有个学生数组存储了学号和姓名,我们需要查找学号为"2014"的学生姓名,这时候我们就需要遍历该数组,并判定学号是否为"201 <?php $student = ...

  3. 剑指Offer 包含min函数的栈

    题目描述 定义栈的数据结构,请在该类型中实现一个能够得到栈最小元素的min函数.   思路: 这个题是想得到一个时间复杂度为O(1)的min函数,所以应用一个辅助栈,压的时候,如果A栈的压入比B栈压入 ...

  4. 读书笔记-js

    定义描述类名或者方法名的注解:ClassOrMethodFullName.java [写一个js方法] 1 2 3 function alertdemo() { // }; function + 方法 ...

  5. 再谈Weiphp公众平台开发——1、增加插件

    去年开始接触基于Weiphp的公众平台开发,一直没时间好好整理一下. 下面开始讲解第一个自定义weiphp插件:MyHello的开发流程. 1.插件创建.在weiphp管理后台依次点击“插件管理-&g ...

  6. SQL Sever2008r2 数据库服务各种无法启动的解决办法

    一.Sql Server服务远程过程调用失败解决 以前出现过这个问题,那时候是因为把实例安装在了D盘,后来D盘被格式化了.然后,这些就没了.今天早上打开电脑,竟然又出现这个问题,可是Server200 ...

  7. CentOS 7 运行级别切换

    CentOS 7 之前的版本是通过 /etc/inittab 文件来定义系统运行级别: [sywu@wusuyuan ~]$ cat /etc/centos-release CentOS releas ...

  8. Thread.Sleep vs. Task.Delay

    We use both Thread.Sleep() and Task.Delay() to suspend the execution of a program for some given tim ...

  9. CLR via C# 随记

    使用C# 编译器的方法: 1.csc.exe位于C:\Windows\Microsoft.NET\Framework\vxxxxx下面,将对应版本的路径配置到环境变量path中,如将";C: ...

  10. POJ 3728

    http://poj.org/problem?id=3278 题目大意就是在同一坐标轴上给你一个人的坐标,一个牛的坐标,而人的运动每一次运动有三种方式,一种是后退1,一种是前进1,还有一种是坐标翻倍, ...