Question

I plan to use the footable jQuery plugin for my tables to make them responsive, but I fail to integrate it into my website. This is my 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>

Error:

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

Console: enter image description here

How can I fix this?

Was it helpful?

Solution

There seems to be some kind of a conflict between application.js (Bootstrap 3.0) and footable.js. I rearranged the order of the includes and was able to resolve the problem:

application.js is now included as the first script:

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

After that, I included all FooTable scripts and CSS files:

<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>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top