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 + '"";