Bootstrap table background pass sort field and ascending descending __bootstrap

Source: Internet
Author: User

$ (' #mytab '). Bootstraptable ({
URL: "Http://localhost/bootstrap/getJsonData?method=index2",//Data source
DataField: "Rows",//server returns data key value that is, the key value of the record is rows, and the key value of the total record number is used when paging
Totalfield: ' Total ',
Height:tableheight (),//Height adjustment
Sidepagination: "Server",//Service End Paging
Method: ' Get ',//Request mode
pagination:true,//whether paging
Escape:true,
Pagenumber:1,
totalrows:0,//server side need to set
Queryparams:function Getparams (params) {
var searchKey1 = $ ("#s1"). Val ();
var SearchKey2 = $ ("#s2"). Val ();
var temp = {//Here's the name of the key and the controller's variable name must always, this side changes, the controller also needs to be changed to the same
Limit:params.limit,//page size
Searchkey1:searchkey1,
Searchkey2:searchkey2,
SortName:this.sortName,
SortOrder:this.sortOrder,

pageindex:this.pagenumber//Current page number
};
return temp;
},
Buttonsalign: "Left",//button alignment
Selectitemname: ' id ',
Toolbar: "#toolbar",
Toolbaralign: ' Left ',
Columns: [
{
Title: "Select All",//titles
width:60,//width
Align: "center",//Level
Checkbox:true,
valign: "Middle"//Vertical

},
{
Field: "id",
Title: "id",
Sortable:true
},
{
Field: "DeviceName",
Title: "DeviceName",
Sortable:true
}
],
Onrefresh:function (params) {
if ($ ("#refreshWay. Active"). Data ("toggle") = = "Off") {
AutoRefresh ();
}
},
Locale: "ZH-CN"//Chinese support
});

Add a sort field and ascending descending field to the background in the Queryparams method

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.