Sort data by page at the backend of bootstrapTable, and sort data by page at the backend of bootstraptable.

Source: Internet
Author: User

Sort data by page at the backend of bootstrapTable, and sort data by page at the backend of bootstraptable.

The back-end paging sorting of data is actually some restrictions on oeder by in SQL statements.

Previously, the order by statement in the SQL statement was written to death. To write live data, the parameter must be passed to the background.

As mentioned earlier, the queryParams of bootstrapTable can be used to customize parameters. Here, you only need to find the field name to be clicked for the column to be sorted.

This. sortName is the field name of the sorting column this. sortOrder sorting method (forward and reverse)

QueryParams: function (params) {// custom parameter. The parameter here is passed to the backend. I use the console for paging. log (this. sortName); console. log (this. sortOrder) return {// The params here is the cp: params provided by table. offset, // start from the database's nth record ps: params. limit, // how many SNS are found: this. sortName, so: this. sortOrder };

You only need to modify order by in the background.

Sqls + = "order by" '+ sn +' "'+ so + '"";

 

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.