您的位置:首页 > 产品设计 > UI/UE

easyui treegrid 分页

2015-07-20 16:27 399 查看
$(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
}

else {

$(this).treegrid('options').url = '/Module/getModuleList?page=1&rows=999&id=' + row.MENU_ID;//打开父节点,防止孩子过多而不显示
}

},
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;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: