源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

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

  • 时间:2022-08-23 14:35 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:BootstrapTable refresh 方法使用实例简单介绍
本文就bootstrapTable refresh 方法如何传递参数做简单举例说明。下面代码中,一个table,一个button,单击button会触发刷新表格操作。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="../libs/bootstrap-table-v1.11.0/bootstrap.min.css" rel="external nofollow" >
<link rel="stylesheet" href="../libs/bootstrap-table-v1.11.0/bootstrap-table.css" rel="external nofollow" >
<script src="../libs/jQuery/jquery-1.8.3.min.js"></script>
<script src="../libs/bootstrap-table-v1.11.0/bootstrap.min.js"></script>
<script src="../libs/bootstrap-table-v1.11.0/bootstrap-table.js"></script>
<script src="../libs/bootstrap-table-v1.11.0/bootstrap-table-zh-CN.js"></script>
</head>
<body>
<table id="item_table"></table>
<button id=refresh_button type="button">刷新</button>
<script>
$('#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 (){
  var opt = {
    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” 以上所述是小编给大家介绍的BootstrapTable refresh 方法使用实例简单介绍,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对编程素材网网站的支持!
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部