$ (' #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