本文就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://local/api/data/?format=json", silent:true, query:{ type:1, level:2 } }; $("#item_table").bootstrapTable('refresh', opt); }); |
refresh发出的请求url为
“http://local/api/data/?format=json&type=1&level=2”