I have a table which has been rendered in my view as shown below:
<table border="1", id="pretty" class="tablesorter">
<thead>
<tr>
<th>LeaveID</th>
<th>Student ID</th>
<th>Leave Start Date</th>
<th>Leave End Date</th>
<th>Leave Reason</th>
<th>Leave Duration</th>
<th>Academic Response</th>
<th>Warden Response</th>
<th>Leave Status</th>
</tr>
</thead>
<% @leaves.each do |leave| %>
<tbody>
<tr>
<td><%= link_to leave.leave_id_prefix+(leave.leave_id).to_s()+'/'+leave.academic_session, generateReport_path(:id_param => leave.student_id) %><br></td>
<td><%= leave.student_id %></td>
<td><%= leave.leave_from %><br></td>
<td><%= leave.leave_to %><br></td>
<td><%= leave.leave_reason %><br></td>
<td><%= leave.leave_duration %></td>
<td><%= leave.academic_status %></td>
<td><%= leave.warden_status %></td>
<td><%= leave.status%></td>
</tr>
</tbody>
<% end %>
</table>
and JavaScript in the View is as shown below to make the rendered table a dataTable.
<script>
$(document).ready(function(){
$("#pretty").dataTable();
});
</script>
I have followed the Ryan Bates' Railcasts http://railscasts.com/episodes/340-datatables?view=asciicast for this purpose.
I have also downloaded the required js and css files to my app.
But I always get this error of
TypeError: Object [object Object] has no method 'dataTable'
How should I go about it.. Any insight will be welcomed..!