JAVa JFinal + EazyUI = Grid example, jfinaleazyui

Source: Internet
Author: User

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


 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.