easyui treegrid 分頁


$(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;
}


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM