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 + 1;

                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;
            }
        }

时间: 2024-08-29 00:21:58

Jquery.Datatables 服务器处理(Server-side processing)的相关文章

jquery datatables api

原文地址 学习可参考:http://www.guoxk.com/node/jquery-datatables http://yuemeiqing2008-163-com.iteye.com/blog/2006942 分别导入css和js文件 <link href="~/Content/bootstrap.css" rel="stylesheet" /> <link href="~/Content/datatables/css/dataTa

jquery datatables api (转)

学习可参考:http://www.guoxk.com/node/jquery-datatables http://yuemeiqing2008-163-com.iteye.com/blog/2006942 1:导入包: URL:http://www.datatables.net/ 分别导入css和js文件 Html代码   <style type="text/css" title="currentStyle"> @import "css/dem

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 wanted to scrap my custom table implementation for a table system that would use JSON to return data rather than have the data be statically allocated

解决方法:An error occurred on the server when processing the URL. Please contact the system administrator

在WINDOWS7或SERVER2008上安装了IIS7.5,调试ASP程序时出现以下错误: An error occurred on the server when processing the URL. Please contact the system administrator 解决方法如下:     设置方法一: 以管理员身份运行CMD,将目录定位到%windir%\system32\inetsrv\,然后执行appcmd set config -section:asp -script

Win7/8出现An error occurred on the server when processing the URL解决办法

报错:An error occurred on the server when processing the URL. Please contact the system administrator. SJY使用的是win8系统搭建的本地服务器,win7使用的方法是相同的.如果你的系统是精简版的Win7/8,那么安装IIS7也有可能出现这问题.下面SJY带领大家来解决这个错误. 解决方法 打开控制面板→管理工具→Internet 信息服务(IIS)管理器→在左边的窗口中找到并点击你的网站→双击右

JQuery Datatables

最近项目中用了Bootstrap的样式风格,控件用了JQuery Datatables,主要有几下几点目标: 实现BootStrap风格的table,使用Ajax获取数据,并有勾选项 可以实现全选,单击勾选 双击行弹出编辑对话框,点击保存使用Ajax传送到服务端保存 实现批量删除 分页操作(下次再记录) 查询操作(下次再记录) 排序操作(下次再记录) 第一部分: 编写一个只有thead的table,tbody会在JS函数中自动生成. HMTL代码如下: 1 <table id="examp

jquery datatables 的常见参数配置

1:导入包: URL:http://www.datatables.net/ 分别导入css和js文件 Html代码   <</span>style type="text/css" title="currentStyle"> @import "css/demo_page.css"; @import "css/demo_table.css"; @import "css/demo_table_jui

解决IIS7运行ASP提示错误:An error occurred on the server when processing the URL. Please contact the system administrator

原文:解决IIS7运行ASP提示错误:An error occurred on the server when processing the URL. Please contact the system administrator 在WINDOWS7或SERVER2008上安装了IIS7,调试ASP程序时出现以下错误: An error occurred on the server when processing the URL. Please contact the system admini

ASP.NET MVC+EF在服务端分页使用jqGrid以及jquery Datatables的注意事项

引言: 本人想自己个博客网站出来,技术路线是用ASN.NET MVC5+EF6(Code First)+ZUI+各种Jquery插件,有了这个想法之后就开始选择UI,看了好多bootstrap的模板之后,发现即使你用了bootstrap还是要自己写css样式,都是自学的,前端真的很垃圾,在网上找了很多UI,以下是各种UI的地址,需要的可以去看看: H-ui:http://www.h-ui.net/H-ui.admin.shtml ,是一个前端大牛弄得,模仿bootstrap,做适合中国网上的UI