Multiple Tables (and even single tab won't format properly
Multiple Tables (and even single tab won't format properly
Dear DataTables Community,
I m pretty new into programming with RoR but anyhow, I dearly wanted to implement the datatables functions. I followed the instructions from the respective Railscast (#340) and got one table to work and look properly. However, when I tried datatables on the rest of my tables nothing really happened. Now I have a page with three tables where one is formatted and the rest looks plain. I thought that multiple tables on one view might cause the problem but even when I visit the view of only one of the corresponding models (e.g. required_capacities model / localhost:3000/required_capacities, the table remains the same. I m really confused: why does one table work and all the others don't? Please help me, this is pretty important as this is an assignment due in ten days. I used the datatables debugger and thats my 6 character assterion:
ocezap
results.js.coffee:
jQuery ->
$('#results').dataTable()
jQuery ->
$('#required_capacities').dataTable()
results view:
Results
Period
Product
Inventory
Production
<% @results.each do |results| %>
<%= results.period %>
<%= results.product %>
<%= results.production %>
<%= results.inventory %>
<% end %>
Required Capacities
Period
Personal Capacities
Additional Personal Capacities
Technical Capacities
<% @required_capacities.each do |required_capacities| %>
<%= required_capacities.period %>
<%= required_capacities.personal_capacities %>
<%= required_capacities.additional_personal_capacities %>
<%= required_capacities.technical_capacities %>
<% end %>
Here's also my application.js:
//= require bootstrap
//= require jquery
//= require jquery_ujs
//= require dataTables/jquery.dataTables
//= require best_in_place
//= require jquery.purr
//= require_tree .
and my application.css
*= require_self
*= require jquery.ui.core
*= require jquery.ui.theme
*= require dataTables/src/demo_table_jui
*= require_tree .
*/
and last but not least, my gemfile:
group :assets do
gem 'sass-rails', '3.2.5'
gem 'coffee-rails', '3.2.2'
gem 'uglifier', '1.2.3'
gem 'jquery-datatables-rails'
gem 'jquery-ui-rails'
I m pretty new into programming with RoR but anyhow, I dearly wanted to implement the datatables functions. I followed the instructions from the respective Railscast (#340) and got one table to work and look properly. However, when I tried datatables on the rest of my tables nothing really happened. Now I have a page with three tables where one is formatted and the rest looks plain. I thought that multiple tables on one view might cause the problem but even when I visit the view of only one of the corresponding models (e.g. required_capacities model / localhost:3000/required_capacities, the table remains the same. I m really confused: why does one table work and all the others don't? Please help me, this is pretty important as this is an assignment due in ten days. I used the datatables debugger and thats my 6 character assterion:
ocezap
results.js.coffee:
jQuery ->
$('#results').dataTable()
jQuery ->
$('#required_capacities').dataTable()
results view:
Results
Period
Product
Inventory
Production
<% @results.each do |results| %>
<%= results.period %>
<%= results.product %>
<%= results.production %>
<%= results.inventory %>
<% end %>
Required Capacities
Period
Personal Capacities
Additional Personal Capacities
Technical Capacities
<% @required_capacities.each do |required_capacities| %>
<%= required_capacities.period %>
<%= required_capacities.personal_capacities %>
<%= required_capacities.additional_personal_capacities %>
<%= required_capacities.technical_capacities %>
<% end %>
Here's also my application.js:
//= require bootstrap
//= require jquery
//= require jquery_ujs
//= require dataTables/jquery.dataTables
//= require best_in_place
//= require jquery.purr
//= require_tree .
and my application.css
*= require_self
*= require jquery.ui.core
*= require jquery.ui.theme
*= require dataTables/src/demo_table_jui
*= require_tree .
*/
and last but not least, my gemfile:
group :assets do
gem 'sass-rails', '3.2.5'
gem 'coffee-rails', '3.2.2'
gem 'uglifier', '1.2.3'
gem 'jquery-datatables-rails'
gem 'jquery-ui-rails'
This discussion has been closed.
Replies
I tried:
jQuery ->
$('#capacity1s').dataTable ({
sPaginationType: "full_numbers"
bJQueryUI: true
bServerSide: true
sAjaxSource: $('#capacity1s').data('source')
"sDom": '<"top">rt<"bottom"flp><"clear">' });
You could remove them from the sDom option (drop the `f` and l` options).
Allan