Trying to do a simple datatables implementation with my rails 3.2 app. I have this exact app working in PHP and wanted to port it to ruby. I am not a Ruby expert just learning it.
I am basically following this example but with my Code and DB
http://asciicasts.com/episodes/340-datatables
-
I created my table and gave it a class and ID
-
I added this file -> /app/assets/javascripts/products.js.coffee which contains
jQuery ->
$(‘#run-table’).dataTablesPaginationType: "full_numbers" bServerSide: true iDisplayLength: 4 aaSorting:[]
What I see on my web page is a properly formatted table with columns, sort icons, search filter text box, pagination numbers all correct. But it does not work.
If I do “bServerSide: true” Then any time I interact with the table I get
"NetworkError: 404 Not Found - http://localhost:3000/null?sEcho=1&iColumns=11&sColumns=&iDisplayStart=0&iDisplayLength=4&...
So if I sort or add a search filter I get that error.
If I change it to “bServerSide: false” Then I get a correct looking table that load with my initial data but does nothing. No sorting, no filter, no pagination.
The part from that sample code I did not do was -> /app/datatables/products_datatable.rb because I did not see a need for it. With PHP I dont use server side and its about 4 lines of code to get this working.
Any help would be great I can provide more code snippets if needed
this was a bug in my code in the view. I had tbody defined inside my loop I needed to move it above my loop. Stupid bug that I spent hours staring at and did not see it.
This works fine now