bootstrap table 方法

bootstrap table showLoading/hideLoading隐藏显示加载进度提示,并自定义提示文字

bootstrap table showLoading/hideLoading隐藏显示加载进度提示,并自定义提示文字。

代码例子

 //显示加载进度提示
 $('#table').bootstrapTable('showLoading');
 //隐藏加载进度提示
 $('#table').bootstrapTable('hideLoading');

自定义提示文字

 //初始化
 $('#table').bootstrapTable({  
    toolbar:"#toolbar",  
    data:data,  
    columns: columns,  
    formatLoadingMessage: function(){ 
            return "自定义提示文字支持html,<br>正在加载中。。。";
      }
  });

在线试一试 

完整例子

<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <script src="https://www.itxst.com/package/bootstrap-table-1.14.1/jquery-3.3.1/jquery.js"></script>
    <link href="https://www.itxst.com/package/bootstrap-table-1.14.1/bootstrap-4.3.1/css/bootstrap.css" rel="stylesheet" />
    <link href="https://www.itxst.com/package/bootstrap-table-1.14.1/bootstrap-table-1.14.1/bootstrap-table.css" rel="stylesheet" />
    <script src="https://www.itxst.com/package/bootstrap-table-1.14.1/bootstrap-table-1.14.1/bootstrap-table.js"></script>
    <title>bootstrap table showLoading/hideLoading例子</title>
    <style>
        .table-demo {
            width: 80%;
            margin: 30px auto 0px auto;
        }
        .fixed-table-header {
            border-right: solid 1px #ddd;
            border-top: solid 1px #ddd;
        }
            .fixed-table-header table  {
                border-top: solid 0px #ddd !important;
                margin-top:-1px;
            }
    </style>
</head>
<body >
   <div id="toolbar">
    <button onclick="showTips()">显示加载提示</button> 
    <button onclick="hideTips()">隐藏加载提示</button> 
  </div>
    <div>
        <table id="table"></table>
    </div>
    <script>
        //设置需要显示的列
        var columns = [{
            field: 'Id',
            title: '编号'
        }, {
            field: 'ProductName',
            title: '名称'
        }, {
            field: 'StockNum',
            title: '库存'
        }];
 
        //bootstrap table初始化数据
        $('#table').bootstrapTable({
           toolbar:"#toolbar", 
          columns: columns,
          classes: "table table-bordered table-striped table-sm table-dark", //设置表格样式
           height:400,
          //******服务器端分页设置****
           url: "/package/bootstrap-table-1.14.1/data.json", //服务器返回数据的网址
           method: 'GET',   //数据请求方式
           sidePagination:'server',
           search:true, //******开启搜索框****//
           searchOnEnterKey:false, //******回车后执行搜索****//
           pagination:true,
           pageNumber:1,
           pageSize:2,
           pageList:"[10, 20, 50, 200]",
           paginationHAlign:"left",
           paginationDetailHAlign:"right",
          queryParams:function(params) {
          /******获取分页数据时,这里你可以带上你自定义的参数******/
            params.action="getlist";
            params.catalogId=0;
            return params; },
           //******服务器端分页设置****
          formatLoadingMessage: function(){ 
            return "自定义提示文字支持html,<br>正在加载中...";
           }
        });


     //显示加载提示
     function showTips()
      {
      $('#table').bootstrapTable('showLoading');
      }


     //隐藏加载提示 
     function hideTips()
      {
      $('#table').bootstrapTable('hideLoading');
      }
    </script>
</body>
</html>
Catalog
bootstrap table方法 bootstrap table事件 bootstrap table配置 bootstrap table下载 基础方法 getOptions获取配置对象 refreshOptions刷新配置 getData获取表格数据方法 getSelections获取选中行方法 getAllSelections所有选中数据 load加载数据方法 mergeCells合并行和列 checkAll全选的方法 uncheckAll反选所有行方法 checkBy根据条件选中行 uncheckBy条件取消中行 refresh重新加载数据的方法 checkInvert反选的方法 destroy注销表格方法 resetView更新表格UI的方法 resetWidth重新适配宽度 showLoading显示加载提示 hideLoading隐藏加载提示 togglePagination隐藏显示分页 toggleFullscreen全屏显示 toggleView切换卡片视图 resetSearch重置搜索框 filterBy数据刷选过滤器 scrollTo滚动到指定位置 getScrollPosition获取当前位置 增删改操作 append追加数据到末尾方法 prepend追加数据到头部方法 remove删除数据的方法 removeAll删除所有数据 insertRow插入一行数据 updateRow更新行数据方法 getRowByUniqueId获取行数据 updateByUniqueId更新行数据 removeByUniqueId删除数据 updateCell更新单元格数据 updateCellByUniqueId更新数据 隐藏显示操作 showRow显示行 hideRow显示行 getHiddenRows获取隐藏的行 show/hide Column隐藏显示列 getVisibleColumns获取显示列 getHiddenColumns获取隐藏列 showAllColumns显示所有列 hideAllColumns隐藏所有列