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+ = ' <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