2
<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

4b0
  • 21,981
  • 30
  • 95
  • 142
wzhang
  • 45
  • 1
  • 1
  • 7
  • 1
    You need to initialize `bootstrapTable` first before using refresh on the same. `$("#selectCaseTable").bootstrapTable();` – Bhavik May 16 '19 at 03:34

5 Answers5

4

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 .

Jean Ouédraogo
  • 234
  • 2
  • 6
  • 16
  • 3
    DataTable and Bootstrap table are two different things see: * https://bootstrap-table.com/ * https://datatables.net/ He can call `bootstrapTable()` if he loads the library properly, or as you said he can call `DataTable()` because that's the library he loaded – Gabi Dj Mar 23 '20 at 15:00
3

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

This error is given when the initial $('#example').DataTable(); after the bootstrapTable library you must include

<script src="https://unpkg.com/bootstrap-table@1.14.2/dist/bootstrap-table.min.js"></script>

After the call $('#example').DataTable(); function.

it's a common issue for any script or function not loaded but you call it then this error given by the client site browser.

Thanks

Md. Abu Sayed
  • 2,396
  • 2
  • 18
  • 26
1

I just added bootstrap related files (js and css) after jquery related files and the issue is gone.

0

you can use

$('button[name="refresh"]').click()

only you need set in your table

data-show-refresh="true"
loppra
  • 61
  • 1
  • 2
0

this worked for me:

let table = $('#table').bootstrapTable({});

table.bootstrapTable('getData')