2013-10-11 72 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> 
相关问题