bootstrap table removeAll把数据从表格中删除的方法

bootstrap table removeAll方法删除表格所有数据,无需参数。

代码例子

//删除表格所有数据
$('#table').bootstrapTable('removeAll');

在线试一试 

完整例子

<!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/jquery-3.3.1/jquery.js"></script>
    <link href="https://www.itxst.com/package/bootstrap-4.3.1/css/bootstrap.css" rel="stylesheet" />
    <link href="https://www.itxst.com/package/bootstrap-table-1.15.3/bootstrap-table.css" rel="stylesheet" />
    <script src="https://www.itxst.com/package/bootstrap-table-1.15.3/bootstrap-table.js"></script> 
    <title>bootstrap table removeAll在线例子</title>
    <style>
        .table-demo {
            width: 80%;
            margin: 30px auto 0px auto;
        }
      .titles {
  float: right;
  clear: both;
}
    </style>
</head>
<body>
  <div id="toolbar">
    <button onclick="deleteAll()">删除所有数据</button> 
  </div>
    <div class="table-demo">
        <table id="table"  ></table>
    </div>
    <script>
        //设置需要显示的列
        var columns = [
            
           { 
           field:"Id",  
          title: 'ID'
        }, {
            field: 'Car',
            title: '品牌'
        } ];
      var data= [{
            Id: 101,
            Car: 'C15', 
        }, {
            Id: 202,
            Car: 'C16', 
        }, {
            Id: 303,
            Car: 'C17', 
      } ];
        
      //bootstrap table初始化数据
      $('#table').bootstrapTable({  
            toolbar:"#toolbar",  
            data:data,
            columns: columns,  
        });
      
     function deleteAll()
     {
      var obj=$('#table');
      obj.bootstrapTable('removeAll');
     }
  
    </script>
</body>
</html>