看了看介绍

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. 关于python 序列 深拷贝

    如果要在循环内修改正在迭代的序列(例如,复制所选的项目),建议首先制作副本.迭代序列不会隐式地创建副本.使用切片就可以很容易地做到: >>> >>> for w i ...

  2. ios10 UNNtificationRequest UNUserNotificationCenter的应用 推送之本地推送

    iOS10 已经 "deprected" 我们的UILocalNotification 采用了全新的UNUserNotificationCenter; 1 首先,你需要引进< ...

  3. 160809228_符瑞艺_C语言程序设计实验3 循环结构程序设计

      #include <stdio.h> int main(){ //使用for循环完成1+2+......+100 ; ;i<=;i++) sum +=i; //sum = sum ...

  4. explicit,violate,volatile,mutable小结

    转自:http://blog.csdn.net/helonsy/article/details/7091130 explicit:放在构造函数前面可以阻止构造函数的隐式类型转换.这样可以避免不必要的错 ...

  5. Android蓝牙连接以及数据接收发送

    1.加入权限 <uses-feature android:name="android.hardware.bluetooth_le" android:required=&quo ...

  6. Qt字符转换

    1.QString  -> char* #include<QTextCodec> QTextCodec::setCodecForLocale(QTextCodec::codecFor ...

  7. c++ vector struct 使用

    1. //test.h #include <string> using namespace std; struct AA { string a1; string a2; string a3 ...

  8. Windows下用python编写简单GUI程序的方法

    Python实现GUI简单的来说可以调用Tkinter库,这样一般的需求都可以实现,显示简单的windows窗口代码如下: python_gui.py #!C:\Python27\python.exe ...

  9. WinAPI: ShellExecute - 打开外部程序或文件

    WinAPI: ShellExecute - 打开外部程序或文件 ShellExecute(   hWnd: HWND;        {指定父窗口句柄}   Operation: PChar;  { ...

  10. selenium webdriver学习(一)

    package baidu; import java.io.File; import java.io.IOException; import junit.framework.TestCase; imp ...