$ (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: ' Module Number ', width:150, align: ' Left ', Hidden: ' True '},
{
Field: ' Menu_name ', title: ' Module name ', width:250, align: ' left '
},
{
Field: ' Nav_url ', title: ' Address ', width:250, align: ' left '
},
{
Field: ' Is_hide ', title: ' Hidden ', width:100, align: ' left '
},
{
Field: ' Show_order ', title: ' Sort ', 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 '
});
Set up pagination controls
var p = $ (' #maintable '). DataGrid (' Getpager ');
$ (P). Pagination ({
pagesize:10,//the number of records displayed per page, default is 10
PageList: [5, 10, 25],//can set a list of the number of record bars per page
Beforepagetext: ' First ',///page text box before the Chinese characters displayed
Afterpagetext: ' page total {pages} ',
Displaymsg: ' current display {from}-{to} ' record ' {total} ' record '
});
});
<div class= "Panel" style= "padding:0 10px; height:520px; " >
<table id= "maintable" class= "Easyui-treegrid" ></table>
</div>
Background code:
public string Getmodulelist ()
{
GET request Information
int intpagesize = Int. Parse (request["Rows"]. ToString ());//Display rows per page
int intcurrentpage = Int. Parse (request["page"]. ToString ());//Current page
String strishide = request["Ishide"]. ToString ();
String strappid = request["AppID"]. ToString ();
String strmodulename = request["ModuleName"]. ToString ();
string strmenuid = request["id"]. ToString ();//parent node value, parameter can only be ID, cannot be other name
Total Record Count
int totalcount = 0;
Paged Get list of users
DataTable dt = Modulebll.getlistbypage (Intpagesize, Intcurrentpage, out TotalCount, strModuleName, Strishide, StrAppID, STRMENUID);
String strresult = easybll.getmodulelist (dt, totalcount);
return strresult;
}
Easyui Treegrid Pagination