欢迎访问 生活随笔!

生活随笔

当前位置: 首页 >

[转]bootstrapTable refresh 方法使用简单举例

发布时间:2025/3/20 45 豆豆
生活随笔 收集整理的这篇文章主要介绍了 [转]bootstrapTable refresh 方法使用简单举例 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

原文地址:https://blog.csdn.net/lanyang123456/article/details/55805478

本文就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"> <link rel="stylesheet" href="../libs/bootstrap-table-v1.11.0/bootstrap-table.css"> <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 方法使用简单举例的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。