bootstrap-table+thinkphp Implementing Server Paging

Source: Internet
Author: User

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

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.