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;
}
$('#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;
}
相关文章推荐
- ListView局部更新(非notifyDataSetChanged)
- [DLX+bfs] hdu 4069 Squiggly Sudoku
- 1007. Maximum Subsequence Sum (25)
- poj 2785 4 Values whose Sum is 0
- UI-导航控制器的使用
- iOS一个开发系列中 - UIButton 使用摘要
- iOS-UIActionSheet提示框
- DWZ(J-UI)之路:错误
- ios 拍照 照片过小 UIImagePickerController
- UIScrollView手动轮播图
- icvGetUsedValues的详细解析
- Qt数据库:(五)QSqlQueryModel
- MSSQL - 用GUID值来完成数据表行标识
- the difficult issue in face recognize
- KBuild MakeFile介绍
- android stuido 在线安装svn插件,添加版本库无响应
- Android UI 自动化测试
- 使用MG-SOFT的MIB Builder编写mib文件或者.my文件方法
- [数论]Number Sequence
- Gradle Plugin Samples 之 Gradle Build Variants(六)