BootstrapTable refresh 方法使用实例简单介绍

作者:袖梨 2022-06-25

本文就bootstrapTable refresh 方法如何传递参数做简单举例说明。下面代码中,一个table,一个button,单击button会触发刷新表格操作。

代码如下 复制代码

$('#item_table').bootstrapTable({

columns: [{

field:'id',

title:'Item ID'

}, {

field:'name',

title:'Item Name'

}, {

field:'price',

title:'Item Price'

}],

data: [{

id: 1,

name:'Item 1',

price:'$1'

}, {

id: 2,

name:'Item 2',

price:'$2'

}]

});

$("#refresh_button").click(function(){

varopt = {

url:"http://lo**ca*l/api/data/?format=json",

silent:true,

query:{

type:1,

level:2

}

};

$("#item_table").bootstrapTable('refresh', opt);

});

refresh发出的请求url为

“http://lo**ca*l/api/data/?format=json&type=1&level=2”

相关文章

精彩推荐