标签:style http color io ar 数据 div sp cti
1.view 代码:
<div style="width:100%;height:100%;">
<table class="easyui-datagrid" style="width:100%;height:95%" data-options="singleSelect:true,url:‘@Url.Action("GetList")‘,method:‘get‘,toolbar:toolbar" pagination="true" sortname="Id" sortorder="asc">
<thead>
<tr>
<th style="width:10%" data-options="field:‘Id‘" sortable="true">编号</th>
<th style="width:15%" data-options="field:‘Name‘" sortable="true">登录名</th>
<th style="width:15%" data-options="field:‘RealName‘" sortable="true">姓名</th>
<th style="width:15%" data-options="field:‘Sex‘" sortable="true">性别</th>
<th style="width:15%" data-options="field:‘Email‘">邮箱</th>
<th style="width:15%" data-options="field:‘Phone‘">电话</th>
<th style="width:15%" data-options="field:‘Address‘">地址</th>
</tr>
</thead>
</table>
</div>
读取数据:GetList 的action
2.Control 代码:
[HttpGet]
public string GetList(int page,int rows, string sort,string order)
{
int total = userService.GetList(x => x.IsDeleted == false).ToList().Count(); //数据总数
var list = userService.GetQueryableList(x => x.IsDeleted == false);
var sortList = userService.Sorting(list, sort, order); //排序
var pageList = userService.Paging(sortList, page, rows); //分页
Dictionary<string, object> data = new Dictionary<string, object>();
data.Add("total", total);
data.Add("rows", pageList);
var json = JsonConvert.SerializeObject(data);
return json;
}
标签:style http color io ar 数据 div sp cti
原文地址:http://www.cnblogs.com/nygsb2014/p/3991140.html