Installed the gem but cannot see any change on table: datatables in Rails 3.2.1:
Installed the gem but cannot see any change on table: datatables in Rails 3.2.1:
arrow0927
Posts: 5Questions: 0Answers: 0
Hi I was following this video tutorial here:
http://railscasts.com/episodes/340-datatables
I got the gems to install on my app. Here are all the files I modified to get it to work:
gemfile:
[code]
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
gem 'jquery-datatables-rails'
end
[/code]
added an id to the table, added the thead and tbody links. Then in the application.js file I added this line
[code]
//= require dataTables/jquery.dataTables
[/code]
in application.css I added this line:
[code]
*= require dataTables/jquery.dataTables
[/code]
In the javascript/coffeescript file I added this line
[code]
jQuery -> $('#rlistings').dataTable()
[/code]
However, I am not seeing the datatable change much. The table has only visually been modified a bit, but there is no search box, no pagination, no sorting capabilities. In short Javascript is not working....
Im confused, as the above video tutorial is quite recent and Ive followed all the steps. Yet, its not working. Ive also looked at this
[code]
https://github.com/rweng/jquery-datatables-rails
[/code]
and followed these steps.
What could I be doing wrong? How can i get this to work?
Where should I start?
Please help me
http://railscasts.com/episodes/340-datatables
I got the gems to install on my app. Here are all the files I modified to get it to work:
gemfile:
[code]
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
gem 'jquery-datatables-rails'
end
[/code]
added an id to the table, added the thead and tbody links. Then in the application.js file I added this line
[code]
//= require dataTables/jquery.dataTables
[/code]
in application.css I added this line:
[code]
*= require dataTables/jquery.dataTables
[/code]
In the javascript/coffeescript file I added this line
[code]
jQuery -> $('#rlistings').dataTable()
[/code]
However, I am not seeing the datatable change much. The table has only visually been modified a bit, but there is no search box, no pagination, no sorting capabilities. In short Javascript is not working....
Im confused, as the above video tutorial is quite recent and Ive followed all the steps. Yet, its not working. Ive also looked at this
[code]
https://github.com/rweng/jquery-datatables-rails
[/code]
and followed these steps.
What could I be doing wrong? How can i get this to work?
Where should I start?
Please help me
This discussion has been closed.
Replies
Allan
I have a column in my datatables implementation which is a link to edit a "listing" like so:
[code]
<% @listings.each do |listing| %>
<%=listing.id%>
<%=link_to listing.name, edit_listing_path(listing) %>
..............
[/code]
Now when this link is clicked it leads to the "show" view of this listing instead of the "edit" view. To try and see if its the link or rails routing, I tried to take the same link and paste it outside the datatable on the same page like so:
[code]
<%=link_to @listings.first.name, edit_listing_path(@listings.first.id) %>
[/code]
this seems to work fine. So that tells me that somehow, all "post"/"put" requests are changed to "get" requests inside the datatable.
Could someone pleae help me to figure out, whether it is possible to embed check boxes and edit links within the datatable?
Thanks a lot
Allan
Thanks