Interface needs: No file download is provided here, please download it on your own website.
<Linkhref= "./css/plugins/bootstrap-table/bootstrap-table.min.css"rel= "stylesheet"type= "Text/css" /><Scriptsrc= "./js/bootstrap.min.js"type= "Text/javascript"></Script><Scriptsrc= "./js/plugins/bootstrap-table/bootstrap-table.min.js"type= "Text/javascript"></Script><Scriptsrc= "./js/plugins/bootstrap-table/locale/bootstrap-table-zh-cn.min.js"type= "Text/javascript"></Script>
Front-end HTML code:
<id= "table"></table>
Front-end javascript: code
$ (' #table '). bootstraptable ({URL:"./infolist",//Request AddressMethod: ' GET ',//RequestStriped:true, Cache:false, pagination:true, sortable:true, Showheader:true, Showrefresh:true, Clicktoselect:true, search:false, Sidepagination:"Server",//client-side server pagenumber:1, pagelist: [10, 15], Queryparams:function(params) {return{offset:params.offset,//Page NumberLimit:params.limit,//Page Size }; }, Columns: [{field:' ID ', Title:' App ID ', Width:' 10% ',}, {field:' Name ', Title:' App name ',}, {field:' Type ', Title:Type, Width:' 10% ',}, {field:' Status ', Title:State, Width:' 10% ',}, {field:' Xznum ', Title:' Download volume ', Width:' 10% ',}, {field:' Phnum ', Title:' Sort number ', Width:' 10% ', }], });
Back-end thinkphp processing:
$limit=Trim(I (' Get.limit '));$offset=Trim(I (' Get.offset '));$page= Floor($offset/$limit) + 1;#get and Calculate page number paging size$list= M (' table ')->where ([' ID ' =>1])->page ($page,$limit),Select ();#Querying related Data$count= M (' table ')->where ([' ID ' =>1])Count();#Query Data Bar number$ret= [ ' Total ' =$list, ' Rows ' =$count, ];#construct return data type$this->ajaxreturn ($ret);#return JSON data
bootstrap-table+thinkphp Implementing Server Paging