TypeError: $ (...).bootstrapTable is not a function

wzhang picture wzhang · May 16, 2019 · Viewed 7.6k times · Source
<table id="selectCaseTable" class="table table-bordered table-striped table-hover">
  <!-- table code... -->
</table>

<!-- jQuery 3 -->
<script src="/static/adminlet-2.4.10/bower_components/jquery/dist/jquery.min.js"></script>
<!-- Bootstrap 3.3.7 -->
<script src="/static/adminlet-2.4.10/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<!-- AdminLTE App -->
<script src="/static/adminlet-2.4.10/dist/js/adminlte.min.js"></script>
<script src="/static/adminlet-2.4.10/bower_components/datatables.net/js/jquery.dataTables.min.js"></script>
<script src="/static/adminlet-2.4.10/bower_components/jquery-slimscroll/jquery.slimscroll.min.js"></script>
<script src="/static/adminlet-2.4.10/bower_components/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>
<!-- FastClick -->
<script src="/static/adminlet-2.4.10/bower_components/fastclick/lib/fastclick.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="/static/adminlet-2.4.10/dist/js/demo.js"></script>

<srcipt>
fuctions addSelectCase(){
    ...
    $("#selectCaseTable").bootstrapTable('refresh');
}
</script>

When I call bootstrapTable("refresh") like below

$("#selectCaseTable").bootstrapTable('refresh');

I see error on console

TypeError: $(...).bootstrapTable is not a function

Answer

Jean Ou&#233;draogo picture Jean Ouédraogo · May 16, 2019

You are supposed to be calling Datatable() not bootstrapTable() as shows the code below:

var table = $('#example').DataTable();
table.ajax.reload();

For further knowledge click here to see previous question .