Java based on Bootstrap_datagrid paging

Source: Internet
Author: User

1, first introduced the DataGrid JS, CSS

$ ("#datagrid"). Bootstrap_datagrid ({URL:"<%=path%>/user/findalluser.html", params: {page:1, PageSize:10, Name:name},singleselect:true, pagination:true, Columns: [[/*{title: "userid", Field: "UserID", Hidden:t Rue,},*/{field:' Name ', Title:' User name ',}, {field:' Telephone ', Title:' Outward display number ',}, {field:' Shortphone ', Title:' Mobile number ',}, {field:' Createtime ', Title:' Create Time ',}, {field:' Power ', Title:' Contact modification Permissions ', Width:100, Formatter:function (v,l) {if(v==0){                                return' No modification '; } Else if(v==1){                                return' Allow modification '; }}},{title:Operation, Formatter:function (v,l) {var c= ' <a href= ' javascript:void (0); "onclick=" Showedit (' +l.userid+ ') "title=" edit "><span class=" FA Fa-edit " Aria-hidden= "true" ></span></a> '; C+ = ' &nbsp;&nbsp;<a href= ' javascript:void (0); "onclick=" Showdel (' +l.userid+ ') "title=" Delete "><span class= "Glyphicon glyphicon-remove" aria-hidden= "true" ></span></a> "; returnC; }                    }                      ] ]                                });
View Code
@RequestMapping ("Findalluser")     Public voidFindaccount (HttpServletRequest req,httpservletresponse Res,intPageintPagesize,string name)throwsexception{domain Domain= (Domain) req.getsession (). getattribute ("Domainlogin"); Page<Users> list =Userservice.findalluser (Domain.getdomainid (), name, page, pageSize); Simplefilterprovider SFP=NewSimplefilterprovider (); Sfp.addfilter ("Userfilter", Simplebeanpropertyfilter.serializeallexcept ("Rechargerecords")); String JSON=Jacksonutil.objtojson (list, SFP);                    WriteString (JSON, RES); }
View Code
@Override PublicPage<users> Findalluser (LongDomainid, String name,intPageintpageSize) {String hql=NULL; if(name==NULL) {hql= "from Users u where u.domainid=" +Domainid; }Else{hql= "From the Users U where u.domainid=" +domainid+ "and lower (u.name) like '%" +name+ "% '"; } Page<Users> Page1 =NewPage<users>(); Page1.setrows (Dao.getentitylist (hql.tostring ()+ "ORDER BY createtime Desc", PageSize, page));        Page1.setpage (page); Page1.settotalcount (DAO.COUNTBYHQL ("SELECT COUNT (u.userid)" +hql)); returnPage1; }
View Code

2. The use of the entity, packaging methods described in the Baidu Cloud Http://pan.baidu.com/s/1dE8jNxB Http://pan.baidu.com/s/1qYTIsCs

Java based on Bootstrap_datagrid paging

Related Article

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.