JAVa JFinal + EazyUI = Grid example, jfinaleazyui
Front-end
<Div id = "dg"> </div>
Js
$ (Function () {$ ('# dg '). datagrid ({height: '400px ', pageNumber: 1, title: 'Log list', pageList: [10, 20, 30, 40, 50], striped: true, pagination: true, rownumbers: true, singleSelect: true, method: 'post', url: '/LogInfo/getloglist', loadMsg:' loading data ...... ', OnBeforeLoad: function (param) {param. falg = new Date () ;}, columns: [{field: 'title', Title: 'title', width: 300, align: 'left'}, {field: 'type', title: 'type', width: 100, align: 'center'}, {field: 'IP', title: 'IP', width: 200, align: 'center'}, {field: 'requesturl', title: 'request address', width: 100, align: 'left'}, {field: 'remark', title: 'Operation information', width: 100, align: 'left'}, {field: 'operationid', title: 'operator ', width: 100, align: 'center'}, {field: 'operationtime', title: 'Operation time', width: 100, align: 'center'}]}); // set the pagination control var p = $ ('# dg '). datagrid ('getpager'); $ (p ). pagination ({pageSize: 10, // number of records displayed per page. The default value is 10 beforePageText: 'dide'. // afterPageText: 'page total {pages} page', displayMsg: 'Current {from}-{to} records total {total} records ',/* onBeforeRefresh: function () {$ (this ). pagination ('loading'); alert ('before refresh '); $ (this ). pagination ('loaded ');}*/});});
Action
public void getLogList() {int page = getParaToInt("page");int rows = getParaToInt("rows");ILogInfo logInfoBusiness = BusinessFactory.CreateLogInfoBusiness();Page<LogInfo> logInfo = logInfoBusiness.GetPageList(page, rows, "",new ArrayList<Object>());renderJson("{\"total\":"+logInfo.getTotalRow()+",\"rows\":" + JsonKit.toJson(logInfo.getList())+"}");}
Obtain the corresponding method
@Overridepublic Page<LogInfo> GetPageList(int page, int rows, String sql,List<Object> param) {if(param.size()==0){param.add(1);}Page<LogInfo> list= LogInfo.me.paginate(page, rows, "select * "," from LogInfo where 1=? "+sql, param.toArray());return list;}