标签:
$(function () {
$(‘#maintable‘).treegrid({
width: ‘98%‘,
height: 550,
nowrap: true,
striped: true,
fit: true,
url: ‘/Module/getModuleList‘,
idField: ‘MENU_ID‘,
fitColumns: false,
queryParams: {
Modulename: $("#txtModuleName").textbox(‘getValue‘),
AppID: $("#txtSystem").combobox(‘getValue‘),
isHide: $("#isHide").combobox(‘getValue‘)
},
columns: [[
{ field: ‘ck‘, checkbox: true },
{ field: ‘MENU_ID‘, title: ‘模块编号‘, width: 150, align: ‘left‘,hidden:‘true‘ },
{
field: ‘MENU_NAME‘, title: ‘模块名称‘, width:250, align: ‘left‘
},
{
field: ‘NAV_URL‘, title: ‘地址‘, width: 250, align: ‘left‘
},
{
field: ‘IS_HIDE‘, title: ‘是否隐藏‘, width: 100, align: ‘left‘
},
{
field: ‘SHOW_ORDER‘, title: ‘排序‘, width: 100, align: ‘left‘
}
]],
onBeforeLoad: function(row,param){
if (!row) { // load top level rows
param.id = 0; // set id=0, indicate to load new page rows
}
},
treeField: ‘MENU_NAME‘,
pagination: true,
rownumbers: true,
pageNumber: 1,
pagePosition: ‘buttom‘
});
//设置分页控件
var p = $(‘#maintable‘).datagrid(‘getPager‘);
$(p).pagination({
pageSize: 10,//每页显示的记录条数,默认为10
pageList: [5, 10, 25],//可以设置每页记录条数的列表
beforePageText: ‘第‘,//页数文本框前显示的汉字
afterPageText: ‘页 共 {pages} 页‘,
displayMsg: ‘当前显示 {from} - {to} 条记录 共 {total} 条记录‘
});
});
<div class="panel " style="padding: 0 10px; height: 520px;">
<table id="maintable" class="easyui-treegrid"></table>
</div>
后台代码:
public string getModuleList()
{
//获取Request信息
int intPageSize = int.Parse(Request["rows"].ToString());//每页展示行数
int intCurrentPage = int.Parse(Request["page"].ToString());//当前页
string strIsHide = Request["isHide"].ToString();
string strAppID = Request["AppID"].ToString();
string strModuleName = Request["Modulename"].ToString();
string strMenuID = Request["id"].ToString();//父节点值,参数只能为id,不能为其他名称
//总记录数
int totalcount = 0;
//分页获取用户列表
DataTable dt = moduleBll.GetListByPage(intPageSize, intCurrentPage, out totalcount, strModuleName, strIsHide, strAppID, strMenuID);
string strResult = easybll.getModuleList(dt, totalcount);
return strResult;
}
标签:
原文地址:http://www.cnblogs.com/flyrain/p/treegrid_page.html