Using onToggle with bootstrap table

by jimkennelly

HTML

<script src="https://code.jquery.com/jquery-3.4.1.slim.js"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.js"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/bootstrap-table.min.css">

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/bootstrap-table.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/extensions/mobile/bootstrap-table-mobile.min.js"></script>

<table
  id="table"
  data-show-columns="true"
  data-search="true"

  data-mobile-responsive="true"
  data-check-on-init="true">
  <thead>
    <tr>
 
      <th data-field="id" data-sortable="true">ID</th>
      <th data-field="id" data-checkbox="true">ID</th>
      <th data-field="name" data-sortable="true">Item Name</th>
      <th data-field="price" data-sortable="true">Item Price</th>
    </tr>
  </thead>
</table>

<script>
  $(function() {
    $('#table').bootstrapTable(
    {
    data: [
    {id:1,name:"jim",price:100},
    {id:2,name:"jim1",price:200},
    {id:3,name:"jim12",price:362},
    {id:4,name:"ji22m",price:9987},
    
    ]
    ,
    onToggle: function (a){
    	console.log('card-view status: ' + a);
    }
    })
  })
</script>

CSS

.row {
  background: #f8f9fa;
  margin-top: 20px;
}

.col {
  border: solid 1px #6c757d;
  padding: 10px;
}