iT邦幫忙

1

bootstrap 4 table 出現 BootstrapTable is not a function

如題:
使用bootstrap 4 table 時,出現 BootstrapTable is not a function
引用之檔案如下:(base_url()是網站之目錄)

<script src="<?php print_r(base_url());?>src/vendor/jquery/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script src="<?php print_r(base_url());?>src/vendor/bootstrap/js/bootstrap.bundle.js"></script>

<link rel="stylesheet" href="https://unpkg.com/bootstrap-table@1.16.0/dist/bootstrap-table.min.css">
<script src="https://unpkg.com/bootstrap-table@1.16.0/dist/bootstrap-table.min.js"></script>

<link href="<?php print_r(base_url());?>src/vendor/bs4-editable/bootstrap-editable.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.7/css/tether.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.7/css/tether-theme-basic.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.7/css/tether-theme-arrows.min.css">
<script src="<?php print_r(base_url());?>src/vendor/bs4-editable/bootstrap4-editable.js"></script>

<link href="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/2.1.4/toastr.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/2.1.4/toastr.min.js"></script>

<script src="<?php print_r(base_url());?>src/vendor/bs4-editable/xlsx.full.min.js"></script>
<script src="<?php print_r(base_url());?>src/vendor/bs-editable/table-export.min.js"></script>
<script src="<?php print_r(base_url());?>src/vendor/bs-editable/table-locale-all.min.js"></script>

錯誤訊息:

jQuery.Deferred exception: $(...).BootstrapTable is not a function TypeError: $(...).BootstrapTable is not a function
    at Object.TableInit.oTableInit.Init (https://網址/dms/table/r6h6o6f6qielkbcp0p95r02pol7mcu0b:214:20)
    at HTMLDocument.<anonymous> (https://網址/dms/table/r6h6o6f6qielkbcp0p95r02pol7mcu0b:206:11)
    at e (https://網址/src/vendor/jquery/jquery.min.js:2:29453)
    at t (https://網址/src/vendor/jquery/jquery.min.js:2:29755) undefined

console 畫面
https://ithelp.ithome.com.tw/upload/images/20200303/20102395AhCIzPpP6i.png

1 個回答

2
dragonH
iT邦超人 5 級 ‧ 2020-03-03 14:26:48
最佳解答

官方範例好像是說 $().bootstrapTable

codepen

參考

如果不行

試試調整 import 的順序

陳軒立 iT邦研究生 5 級 ‧ 2020-03-03 16:50:47 檢舉

已順利解決,謝謝大大,小弟打成BootstrapTable,沒發現,謝謝您!

dragonH iT邦超人 5 級 ‧ 2020-03-03 17:01:30 檢舉

/images/emoticon/emoticon12.gif

我要發表回答

立即登入回答