BootstrapTable refresh 方法使用实例简单介绍
本文就bootstrapTablerefresh方法如何传递参数做简单举例说明。下面代码中,一个table,一个button,单击button会触发刷新表格操作。
<!DOCTYPEhtml>
<htmllang="en">
<head>
<metacharset="utf-8">
<linkrel="stylesheet"href="../libs/bootstrap-table-v1.11.0/bootstrap.min.css"rel="externalnofollow">
<linkrel="stylesheet"href="../libs/bootstrap-table-v1.11.0/bootstrap-table.css"rel="externalnofollow">
<scriptsrc="../libs/jQuery/jquery-1.8.3.min.js"></script>
<scriptsrc="../libs/bootstrap-table-v1.11.0/bootstrap.min.js"></script>
<scriptsrc="../libs/bootstrap-table-v1.11.0/bootstrap-table.js"></script>
<scriptsrc="../libs/bootstrap-table-v1.11.0/bootstrap-table-zh-CN.js"></script>
</head>
<body>
<tableid="item_table"></table>
<buttonid=refresh_buttontype="button">刷新</button>
<script>
$('#item_table').bootstrapTable({
columns:[{
field:'id',
title:'ItemID'
},{
field:'name',
title:'ItemName'
},{
field:'price',
title:'ItemPrice'
}],
data:[{
id:1,
name:'Item1',
price:'$1'
},{
id:2,
name:'Item2',
price:'$2'
}]
});
$("#refresh_button").click(function(){
varopt={
url:"http://local/api/data/?format=json",
silent:true,
query:{
type:1,
level:2
}
};
$("#item_table").bootstrapTable('refresh',opt);
});
</script>
</body>
</html>
refresh发出的请求url为
“http://local/api/data/?format=json&type=1&level=2”
以上所述是小编给大家介绍的BootstrapTablerefresh方法使用实例简单介绍,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对毛票票网站的支持!