-
Notifications
You must be signed in to change notification settings - Fork 338
Open
Description
I get the following error in the console when I try to use DataTables
Uncaught TypeError: $(...).DataTable is not a function
I ran the following code to setup dataTables
gem 'jquery-datatables-rails', '~> 3.3.0'
bundle install
$ rails generate jquery:datatables:install
$ rails generate jquery:datatables:install bootstrap3
$ rails generate jquery:datatables:install responsive
I restarted the rails server, and added this code.
//my_javascript.js
$(document).ready(function(){
$('#test-table').DataTable({
responsive: true
});
});
//my_erb_file.erb
<table class="display" id="test-table">
<thead>
<tr>
<th>Name</th>
<th>Job</th>
<th>Start date</th>
<th>Location</th>
<th>Desk Location</th>
<th>Manager</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<tr class="options">
<td>test</td>
<td>test</td>
<td>test</td>
<td>test</td>
<td>test</td>
<td>test</td>
<td>test</td>
</tr>
</tbody>
</table>
Metadata
Metadata
Assignees
Labels
No labels