jquery datatables+MVC+WCF
view
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<title>111</title>
<link href="~/Content/jquery.dataTables.css" rel="stylesheet" />
<script src="~/Scripts/jquery-1.11.1.js"></script>
<script src="~/Scripts/jquery.dataTables.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$('#myDataTable').dataTable({
"bServerSide": true,
"bProcessing": true,
"sAjaxSource": "/User/GetAllUserDtoHandler",
"aoColumns": [{
"bVisible": true,
"mData": "UserName",
"aTargets": [0]
}, {
"bVisible": true,
"mData": "RealName",
"aTargets": [1]
}, {
"bVisible": true,
"mData": "RoleName",
"aTargets": [2]
}, {
"bVisible": true,
"mData": "DeptName",
"aTargets": [3]
}, {
"bVisible": true,
"mData": "CompanyName",
"aTargets": [4]
}, {
"bVisible": true,
"mData": "Address",
"aTargets": [5]
}, {
"bVisible": true,
"mData": "MobilePhone",
"aTargets": [6]
}],
"aoColumnDefs": [{
sDefaultContent: '',
aTargets: ['_all']
}],
"oLanguage": {
"sProcessing": "正在加载中......",
"sLengthMenu": "每页显示 _MENU_ 条记录",
"sZeroRecords": "没有数据!",
"sEmptyTable": "表中无数据存在!",
"sInfo": "当前显示 _START_ 到 _END_ 条,共 _TOTAL_ 条记录",
"sInfoEmpty": "显示0到0条记录",
"sInfoFiltered": "数据表中共为 _MAX_ 条记录",
"oPaginate": {
"sFirst": "首页",
"sPrevious": "上一页",
"sNext": "下一页",
"sLast": "末页"
}
}
});
});
</script>
</head>
<body>
<table id="myDataTable" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>
用户名
</th>
<th>
真实姓名
</th>
<th>
角色
</th>
<th>
所属部门
</th>
<th>
所属单位
</th>
<th>
地址
</th>
<th>
电话号码
</th>
</tr>
</thead>
<tbody></tbody>
</table>
</body>
</html>
controller
public JsonResult GetAllUserDtoHandler(DataTableParameter param)
{
using (ChannelFactory<IUserService> channelFactory = new ChannelFactory<IUserService>("userService"))
{
IUserService proxy = channelFactory.CreateChannel();
var userDtos = proxy.GetAllUserDto(param.iDisplayStart, param.iDisplayLength);
if (userDtos.Count > 0)
{
var list = new List<object>();
foreach (UserDto u in userDtos)
{
list.Add(new
{
u.UserName,
u.RealName,
u.RoleName,
u.DeptName,
u.CompanyName,
u.Address,
u.MobilePhone
});
}
return Json(new
{
sEcho = param.sEcho,
iTotalRecords = userDtos.Count,
iTotalDisplayRecords = userDtos.Count,
aaData = list
}, JsonRequestBehavior.AllowGet);
}
}
return null;
}
WCF后台略
jquery datatables+MVC+WCF的更多相关文章
- ASP.NET MVC+EF在服务端分页使用jqGrid以及jquery Datatables的注意事项
引言: 本人想自己个博客网站出来,技术路线是用ASN.NET MVC5+EF6(Code First)+ZUI+各种Jquery插件,有了这个想法之后就开始选择UI,看了好多bootstrap的模板之 ...
- Mvc.JQuery.Datatables
1.NuGet安装Mvc.JQuery.Datatables.Mvc.JQuery.Datatables.Templates和JQuery.Datatables https://github.com/ ...
- jQuery DataTables and ASP.NET MVC Integration
part 1 : http://www.codeproject.com/Articles/155422/jQuery-DataTables-and-ASP-NET-MVC-Integration-Pa ...
- Jquery DataTables warning : Requested unknown from the data source for row 0
昨天在做 Jquery DataTables 的时候,遇到的一个问题,我使用MVC,在tables上加入了一个actionlink的href.但是在运行起来的时候,报错: DataTables war ...
- 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 网格
对于服务器来说,可以通过请求参数来获得当前的操作信息. 类型 名称 说明 int iDisplayStart 显示的起始索引 int iDisplayLength 显示的行数 int iColumns ...
- 使用TT模板+mvc+wcf实现简单查询
今天是除夕,小编的这篇博客是掐着点儿发的,在此,祝各位小伙伴新年快乐,身体健康,万事如意:喜从天降,欣喜若狂:喜气盈门,好事成双:好人好运,金玉满堂:神采飞扬,如愿以偿,财源滚滚来,福如东海长:伴随着 ...
- [jQuery]jQuery DataTables插件自定义Ajax分页实现
前言 昨天在博客园的博问上帮一位园友解决了一个问题,我觉得有必要记录一下,万一有人也遇上了呢. 问题描述 园友是做前端的,产品经理要求他使用jQuery DataTables插件显示一个列表,要实现分 ...
- jquery Datatables 行数据删除、行上升、行下降功能演示
Datatables 是一款jquery表格插件.它是一个高度灵活的工具,可以将任何HTML表格添加高级的交互功能. 官方网站:http://www.datatables.net Datatables ...
随机推荐
- python大法好——飞机大战
import pygame from pygame.locals import * import time def key_control(hero_temp): # 获取事件,比如按键等 for e ...
- 容器部署解决方案Docker
容器部署解决方案Docker 课程目标 目标1:了解Docker与虚拟机的不同点,相比的优势 目标2:掌握Docker的启动方法 目标3:掌握Docker镜像操作 目标4:掌握Docker容器操作 ...
- 1_Python历史及入门
前提:简述CPU 内存 硬盘 操作系统 应用程序CPU:计算机的运算核心和控制核心,好像人类的”大脑“内存:负责数据与CPU直接数据交流处理,将临时数据和应用程序加载到内存,然后在交由CPU处理. 造 ...
- RuntimeError: module compiled against API version 0xb but this version of numpy is 0xa
两个python,一个是本机自带的,一个是anaconda.先前呢,用自带的安装了Opencv,由于自带的python,对应的numpy版本是13, 而anaconda对应的版本是12,导致impor ...
- nohup 写法
nohup 空格 php程序路径 空格 php脚本路径 >> .out日志路径 2>&1 &
- JeeWx全新版本发布!捷微二代微信活动平台1.0发布!活动插件持续开源更新!
JeeWx捷微二代微信活动平台 (专业微信营销活动平台,活动插件持续更新ing~) 终于等到你!还好我没放弃! 在团队持续多年的努力下,Jeewx微信管家和H5活动平台不断更新迭代,积累了许许多 ...
- mount.cifs permission denied
[root@dev ~]# mount.cifs //192.168.9.155/APP /mnt/APP/ -o user=administrator,pass=dsff#$TTT 在检查帐号密码权 ...
- 提升lua代码效率
local test = {} , do test[ i ] = {} end local t1 = os.clock( ) , do test[ ].mValue = end local t2 = ...
- 最大矩阵(简单DP)
见题: 很水的一题,数据范围太小,前缀和加爆搜就行. #include<bits/stdc++.h> using namespace std; ; ,m,n,sum[maxn][maxn] ...
- openpyxl一点心得
先上代码 from openpyxl import workbook,load_workbook class HomeWork(): def creat_xlsx(self): "" ...