2013-10-11 109 views
0

我打算使用我的表的footable jQuery插件使它們響應,但我無法將它集成到我的網站。這是我的CSS:對象[對象對象]沒有方法'腳下'

<link href="FooTable-2/css/footable.core.css?v=2-0-1" rel="stylesheet" type="text/css"/> 
<link href="FooTable-2/css/footable.metro.css" rel="stylesheet" type="text/css"/> 
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" type="text/javascript"></script> 
<script src="FooTable-2/js/footable.js?v=2-0-1" type="text/javascript"></script> 
<script src="FooTable-2/js/footable.sort.js?v=2-0-1" type="text/javascript"></script> 
<script src="FooTable-2/js/footable.filter.js?v=2-0-1" type="text/javascript"></script> 
<script src="FooTable-2/js/footable.paginate.js?v=2-0-1" type="text/javascript"></script> 
<script src="build/javascripts/application.js" type="text/javascript"></script> 

JS:

<script type="text/javascript"> 
    $(function() { 
     $('.footable').footable(); 
    }); 
</script>  

HTML:

<table class="footable"> 
<thead> 
<tr> 
    <th></th> 
    <th data-hide="phone,tablet">Nummer</th> 
    <th>Vorname</th> 
    <th>Nachname</th> 
    <th>Adresse</th> 
    <th data-hide="phone,tablet">Telefon</th> 
    <th>E-Mail</th> 
    <th data-hide="phone,tablet">Geburtstag</th> 
    <th>Kundentyp</th> 
</tr> 
</thead> 
<tbody> 

錯誤:

$('.footable').footable(); 
Uncaught TypeError: Object [object Object] has no method 'footable' 

控制檯: enter image description here

我該如何解決這個問題?

+1

確保您的腳本引用是正確的。檢查您的瀏覽器開發工具的網絡選項卡是否有404錯誤。 –

+0

顯然,插件沒有被加載。控制檯中應該有其他錯誤告訴你爲什麼。 –

+0

沒有404錯誤。我之前檢查過。 – doonot

回答

0

application.js(Bootstrap 3.0)和footable.js之間似乎有某種衝突。我重新安排的包括順序,並能解決問題:

application.js現在包括作爲第一個腳本:

<script src="build/javascripts/application.js" type="text/javascript"></script> 

在那之後,我包括了所有FooTable腳本和CSS文件:

<link href="FooTable-2/css/footable.core.css?v=2-0-1" rel="stylesheet" type="text/css"/> 
<link href="FooTable-2/css/footable.metro.css" rel="stylesheet" type="text/css"/> 
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" type="text/javascript"></script> 
<script src="FooTable-2/js/footable.js?v=2-0-1" type="text/javascript"></script> 
<script src="FooTable-2/js/footable.sort.js?v=2-0-1" type="text/javascript"></script> 
<script src="FooTable-2/js/footable.filter.js?v=2-0-1" type="text/javascript"></script> 
<script src="FooTable-2/js/footable.paginate.js?v=2-0-1" type="text/javascript"></script> 
相關問題